asmvik / asmvik/yabai

Move window in stack

Open
#2,396 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
29.6k
Forks
758
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the yabai -m window --swap stack.prev behavior and tracing the window --swap command handling. Compare focus behavior for the direct command and the shell workaround, then determine the intended post-swap focus semantics. Done means the chosen behavior is implemented or exposed as an option without the reported focus flicker, with coverage for stacked-window swaps.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, macos
Domain
desktop, operating-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.