baskerville / bspwm

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

Focusing east across monitors sometimes focuses the wrong window #662

Closed TheZoq2 closed 7 years ago

TheZoq2 commented 7 years ago

With the following window setup:

|---------------| |---------------| 
|               | |       |       | 
|   window 1    | |window2|window3| 
|               | |       |       | 
|---------------| |---------------| 
Monitor 1 ^         Monitor 2

If window 1 is focused, and I execute bspc node focused -f east, window 3 gets focused instead of window 2. It also looks like window 2 gets focused for a very short time before 3 gets focused.

This also seems to happen if the window2 'node' is split into more more nodes.

However, if window 3 is split horizontally like this:

|---------------| |---------------| 
|               | |       |window4| 
|   window 1    | |window2|-------| 
|               | |       |window5| 
|---------------| |---------------| 
Monitor 1 ^         Monitor 2

Everhthing seems to work fine

Also, focusing west, east, north and south seem to work without issues

Here is a link to my dotfiles if they could cause issues. Most of the files in there are not used anymore but I havn't gotten around to cleaning them up https://github.com/TheZoq2/dotfiles/tree/master/.config/bspwm

baskerville commented 7 years ago

Does bspc query -N -n east return the correct value?

TheZoq2 commented 7 years ago

Yes, query seems to work fine

TheZoq2 commented 7 years ago

I tested it again and it looks like I did something wrong when testing it last time. bspc query -N -n east also returns the wrong node

msteen commented 7 years ago

@TheZoq2 Are you sure the problem lies with bspwm and not your script? I just tried to reproduce this issue, but was unable to do so (I am running the latest git master). Both bspc node focused -f east and bspc query -N -n east give correct results.

Why the Python script? Why not just use:

super + {Left,Down,Up,Right}
  d={west,south,north,east}; \
  bspc node --focus $d || \
  bspc monitor --focus $d

super + shift + {Left,Down,Up,Right}
  d={west,south,north,east}; \
  bspc node --swap $d || \
  bspc node --to-monitor $d

In my own config I also added priority to the preselected.

super + shift + {Left,Down,Up,Right}
  d={west,south,north,east}; \
  bspc node --to-node "${d}.!automatic" || \
  bspc node $d --to-node 'focused.!automatic' || \
  bspc node --swap $d || \
  bspc node --to-monitor $d

An idea I took over from this config.

TheZoq2 commented 7 years ago

I just tried it and it seems to work in the current bspwm version so I guess the issue is fixed.

I didn't know you could do what my python script does just using sxhkd, I'll give that a try later