baskerville / bspwm

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

[QUESTION] Raise floating window to top? #1300

Closed levouh closed 3 years ago

levouh commented 3 years ago

Is there a good way to raise a floating window when two exist, and the focused one is below the other for one reason or another? This doesn't need to happen automatically as I can trigger it via other means manually, but things like:

$ xdo -id <id> raise 
$ xdotool windowraise <id>

don't seem to work, nor does bspc provide a way to do this (beyond layers, but if the two windows are in the same layer this doesn't help). I've also tried simple things like:

$ bspc node <id> -f

but focusing is not synonymous with raising. I found older issues that note things like adaptative_raise and potentially raise_on_focus but looking at settings.c and trying these with bspc config ..., these seemingly don't exist anymore.

emanuele6 commented 3 years ago

I use this hotkey (super + g, but super + shift + g is also available to go in the reverse order) to cycle between floating windows:

# Focus a floating window / Cycle floating windows.                             
super + {_,shift + }g                                                           
    bspc node 'focused.floating#{next,prev}.local.!hidden.floating' -f \    
        || bspc node 'last.local.!focused.!hidden.floating' -f \            
        || bspc node  'any.local.!focused.!hidden.floating' -f  

I found older issues that note things like adaptative_raise and potentially raise_on_focus but looking at settings.c and trying these with bspc config ..., these seemingly don't exist anymore.

If you want to have floating windows raise when they are focused by the mouse pointer (focus_follows_pointer), you can use this script (make it run in the background):

#!/bin/bash

while bspc subscribe node_focus -c 1 > /dev/null; do
    bspc node -f
done
baskerville commented 3 years ago

Is there a good way to raise a floating window when two exist, and the focused one is below the other for one reason or another?

What else, besides focus_follows_pointer, could be the reason for that?

levouh commented 3 years ago

Not sure, that's why I've posted here.

The general case to recreate, at least as far as I've seen, is having a floating window focused and another unmapped. When the unmapped window is mapped again, I have a script that then calls bspc node <id> -f on it. The recently mapped window is clearly focused based on the drawn border, but the previous focused window is still drawn on top. Note that I also have focus_follows_pointer set to false, however if I am having a script control the focusing, etc. (I've also tested manually calling bspc on the window ID) I don't see how this applies.

Should focused floating windows always be on top of unfocused ones?

emanuele6 commented 3 years ago

The general case to recreate, at least as far as I've seen, is having a floating window focused and another unmapped. When the unmapped window is mapped again, I have a script that then calls bspc node -f on it.

I was not able to reproduce this.

I tried:

And:

Anyway, if this is what you mean, you should really be using node -g hidden=off and node -g hidden=on instead of xdo hide and xdo show if you plan on hiding floating windows.

Do you mean something else with "unmapped" and "mapped again"? Can you give reproduction steps?

emanuele6 commented 3 years ago

Should focused floating windows always be on top of unfocused ones?

If you are having this problem only with one specific program's windows, that program could be setting its windows' layer to above.

levouh commented 3 years ago

It was an issue with the above state of the various windows, thanks for the help @emanuele6.