baskerville / bspwm

A tiling window manager based on binary space partitioning
BSD 2-Clause "Simplified" License
7.72k stars 414 forks source link

Shadow window when focusing next window on a desktop #1177

Closed ThibaudDauce closed 4 years ago

ThibaudDauce commented 4 years ago

I have a command to focus the next/previous window in a desktop:

alt + {_,shift + } Tab
        bspc node -f {next,prev}.local

When there is more than two windows, I get a third blank one, when querying I get:

➜  /tmp xtitle $(bspc query -N -n focused)

➜  /tmp bspc query -N -n focused
0x0040000E
➜  /tmp xprop -id $(bspc query -N -n focused)
X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  21 (X_ListProperties)
  Resource id in failed request:  0x40000e
  Serial number of failed request:  12
  Current serial number in output stream:  12

These three commands are working when the focus is on the two real windows:

➜  /tmp xtitle $(bspc query -N -n focused)
thibaud@cortex: /tmp
➜  ~ xtitle $(bspc query -N -n focused)
thibaud@cortex: ~

Other issue, when using my kill command:

ctrl + {_, shift +} q
        bspc node -{c,k}

When the focus is on one of the real windows, everything is working (the windows is killed), when the focus is one the shadow window, the two real windows are killed.

When there is 3 windows, it seems the shadow window appears between each switch. Real window 1 -> shadow -> Real window 2 -> shadow -> Real window 3 -> shadow -> Real window 1 -> …

Do you have an idea?

emanuele6 commented 4 years ago
alt + {_,shift + } Tab
        bspc node -f {next,prev}.local

I have a command to focus the next/previous window in a desktop:

Here is where you are wrong: next and prev can select any bspwm node, not just windows (changed in bspwm 0.9.10).

Those are not "shadow windows", those are non-leaf bspwm nodes.

focused can select any bspwm node as long as it is focused (it has always behaved like this, this wasn't changed in the last update).

bspc query -N -n focused, when the focused bspwm node is a not a window node, will return the node id of the focused node. These ids are not X Window ids; xprop -id <id> gives you the BadWindow error because that id not the id of an X Window, it's just an internal ID of bspwm... You can't get a title from that id with xtitle for the same reason: that's not the id of an X Window!

Other issue, when using my kill command:

ctrl + {_, shift +} q
        bspc node -{c,k}

When the focus is on one of the real windows, everything is working (the windows is killed), when the focus is one the shadow window, the two real windows are killed.

That's not an issue: when you "kill" a non-leaf bspwn node, all of its children bspwn nodes are killed; when you "close" a non-leaf bspwn node, all of the windows contained in its children bspwn nodes are closed. That is totally intended.

As you can read from the CHANGELOG, if you want to use next.local and prev.local to select the "next local non-hidden window" bspwm node, use the proper (explicit) selector:

alt + {_,shift + } Tab
        bspc node -f '{next,prev}.local.!hidden.window'

# ADDITIONAL NOTE: this is a duplicate of #1168, #1171 and #1172.

emanuele6 commented 4 years ago

Also, if you want to get the id of the focused X window, use:

Don't use bspc query -N -n focused: it isn't meant to be used for that.

ThibaudDauce commented 4 years ago

Hi,

Thanks a lot for the long explanation.

I used xtitle, xprop and bspc query -N -n focused to try to debug the situation. My real problem was with the switching and the !hidden.window fixed the problem.

Sorry about the duplicate, I made a few searches on the issues but didn't find these ones…

I should have read the changelog (but I wasn't sure it was working correctly before and didn't see a particular update with Pacman recently).

Sorry for the inconvenience.