#1537·bspwm

Floating, focused window raises above other floating windows when changing desktops

Author: scfarleyCreated Oct 22, 2025Updated Oct 22, 2025

When two windows, such as two xterms, are on a desktop where every window is floating, the focused window will raise above all other windows when switching between another monitor with the mouse or a desktop on the same monitor with the keyboard (hotkey). I wish to keep the desktop in the same state as I left it but still allow raising a window with bspc node -f next.local.window. The only thing I can change that alters this is setting focus_follows_pointer to false.

My setup:

  • bspwm 0.9.11 (and 0.9.12)
  • FreeBSD 14
  • All desktops are in monocle layout. Needed for a script I am writing.
  • bspwmrc (important bits):
    bspc config border_width         1
    bspc config window_gap          12
    bspc config borderless_monocle     true
    bspc config gapless_monocle        true
    bspc config focus_follows_pointer   true
    bspc config pointer_follows_monitor true
    bspc config pointer_modifier mod1
    bspc rule -r '*:*:*'
    bspc rule -a '*' state=floating

My only experiment in the code is with this:

diff
diff --git a/src/tree.c b/src/tree.c
index 52055c5..3d8641e 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -671,9 +671,9 @@ bool focus_node(monitor_t *m, desktop_t *d, node_t *n)
 		return true;
 	}
 
-	put_status(SBSC_MASK_NODE_FOCUS, "node_focus 0x%08X 0x%08X 0x%08X\n", m->id, d->id, n->id);
+	put_status(SBSC_MASK_NODE_FOCUS, "node_focus 0x%08X 0x%08X 0x%08X %d\n", m->id, d->id, n->id, desk_changed);
 
-	stack(d, n, true);
+	stack(d, n, !desk_changed);
 
 	if (pointer_follows_focus) {
 		center_pointer(get_rectangle(m, d, n));

However, this does fix things because focus_node() is called twice when changing desktops. The second time it is called the desktop is considered unchanged, therefore, the window is raised.

WMHDMI-0:OI:fII:fIII:fIV:LM:TF:G:mDP-0:OV:fVI:fVII:fVIII:LM:TF:G
monitor_focus 0x01200004
desktop_focus 0x01200004 0x01200007
WmHDMI-0:OI:fII:fIII:fIV:LM:TF:G:MDP-0:OV:fVI:fVII:fVIII:LM:TF:G
node_focus 0x01200004 0x01200007 0x0220001E 1
WmHDMI-0:OI:fII:fIII:fIV:LM:TF:G:MDP-0:OV:fVI:fVII:fVIII:LM:TF:G
node_focus 0x01200004 0x01200007 0x0220001E 0
node_stack 0x0220001E above 0x01E0001E

I guess that this is unexpected as the commit 44414046b944df61866d1ecc9eee47be96604f7d suggests that raising a window should not be due to focus_follows_pointer.

This issue could also be related to #1186.