dimgray

BSPWM Manual Swap 2 Windows

In BSPWM, it is possible to swap between 2 windows by leveraging on the marked flag. This can be done by implementing 2 keybindings in your sxhkdrc file.

The first keybinding does 2 things. Firstly, the line of code before the && operator un-mark all existing marked windows. Secondly, right after the && operator, it mark the currently focused window.

# mark window
super + g
    while read -r line; do bspc node "$line" -g marked; done < <(bspc query -N -n .marked) && bspc node -g marked

Naturally, you would proceed to focus on another window and executing this second keybinding would swap this window with the previously marked window.

# swap with marked window
super + shift + g
    bspc node -s any.marked