You are not logged in.

#1 2020-10-05 20:46:56

shoelesshunter
Member
From: USA
Registered: 2014-05-18
Posts: 289

i3 window instance

I no longer get accurate window instances reported by the xprop/xwininfo script.

For instance, I use termite, and when running ranger, the window gets reported as class=Termite instance=termite

as opposed to instance=ranger.

as such my i3 config no longer floats nor assigns windows accurately.

Offline

#2 2020-10-05 21:32:46

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: i3 window instance

How do you launch termite to run ranger?  If you want to specify class names for the terminal, this must be done by the terminal program itself: most of them have a command line option for this.  Nothing running within the terminal can set the class name.  Programs running in the terminal can and often do set the WM_NAME - ranger does.  So either you should have your i3 config floating rule match on the WM_NAME, or launch termite with the appropriate flag to specify a class name.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2020-10-05 21:38:10

merlock
Member
Registered: 2018-10-30
Posts: 233

Re: i3 window instance

I use kitty, and have the same if I launch ranger from an open terminal window.

However, if I use the command:

kitty -e ranger

xprop and xwininfo show window name as ranger.

Note: -e might be depreciated; this does the same thing:

kitty --hold ranger

Only difference is that the former command closes the kitty window when ranger exits, the latter needs a Ctrl-c to close the kitty window.


Eenie meenie, chili beanie, the spirits are about to speak -- Bullwinkle J. Moose
It's a big club...and you ain't in it -- George Carlin
Registered Linux user #149839
perl -e 'print$i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10); '

Offline

#4 2020-10-05 21:46:59

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: i3 window instance

merlock wrote:

... xprop and xwininfo show window name as ranger.

Yes, that's the window name, not the resource name or resource class (which are the two values in WM_CLASS).

The window name should be set when ranger is run regardless of how it is started.  If it isn't, something is wrong with the terminal or your terminfo settings (a common problem from manually setting a TERM variable).

EDIT: FYI, both termite and kitty accept command line flags of --name or --class to specify resource name and resource class values which would be used by i3wm's matching rules.  Also very few - if any - window managers will accept window rules based on WM_NAME (the "title" set by programs like ranger) as it is to dynamic.  I3 will not match on the window name, but only the resource class and resource name (which it calls "instance") - these cannot be set by client programs running within the terminal.

Last edited by Trilby (2020-10-05 21:52:19)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2020-10-05 22:00:47

merlock
Member
Registered: 2018-10-30
Posts: 233

Re: i3 window instance

Thanks, Trilby.

Learned something new today.


Eenie meenie, chili beanie, the spirits are about to speak -- Bullwinkle J. Moose
It's a big club...and you ain't in it -- George Carlin
Registered Linux user #149839
perl -e 'print$i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10); '

Offline

#6 2020-10-06 12:00:55

willemw
Member
Registered: 2013-02-19
Posts: 113

Re: i3 window instance

@Trilby: You can filter (regex) on the window title in i3: for_window [class="..." title="..."]

Offline

#7 2020-10-06 12:33:58

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: i3 window instance

Ah, I suppose you can.  I swear it wasn't here yesterday when I checked.  Guess I was out of it.  As noted, I don't use i3, so I just glanced at the docs.  I'd be curious whether title based rules are (re-)applied every time the title changes, or is it just when the window is mapped?

In any case, title is still different than instance, and the client program can't set the WM_CLASS of the controlling terminal.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#8 2020-10-06 13:02:46

willemw
Member
Registered: 2013-02-19
Posts: 113

Re: i3 window instance

The rules are not applied when the title changes, but when the window appears for the first time (mapped?) and perhaps in other situations/instances.

In general:

Regex matching on the window title in i3 can be useful in my experience. When you do an xprop on a window, you will see all its window properties. But when you try to match on the "class" (WM_CLASS) and/or I think especially the "instance" (WM_NAME) properties for that window type in i3, it may not work. It seems as if i3 in some cases applies the window rules too early, just before all the window properties are assigned. In that case it can be useful to (also) match on the window title.

Offline

Board footer

Powered by FluxBB