koekeishiya / yabai

A tiling window manager for macOS based on binary space partitioning
MIT License
24.15k stars 645 forks source link

Move window in stack #2396

Open jbriales opened 3 months ago

jbriales commented 3 months ago

I have some skhd bindings to move a window within a stack. Technically this can be done e.g. with yabai -m window --swap stack.prev BUT this will change focus to the other window, losing focus from the current one.

A fix/workaround is to do like this: yabai -m window --swap stack.prev; yabai -m window --focus stack.prev

However this results in some visual flicker effect since the other window is focused for a brief moment.

Other things I tried:

...

yabai -m window --swap stack.prev --focus stack.prev This does not work

Specify to focus the initial window in the same command:

yabai -m window --swap stack.prev --focus $(yabai -m query --windows id --window | jq -r .id) This has a shorter flicker but still has it.

Q:

Is there some alternative I'm missing? Otherwise, would it make sense for the --swap command to keep focus on the currently selected window? Or at least make the behavior on which window to focus after the swap an option?

Bellavene commented 3 months ago

Agreed. It makes more sense to leave the focus on the window you are stacking currently.