Windows changing while switching between spaces in stack layout
- Dominant language
- C
- Stars
- 29.6k
- Forks
- 750
- PR merge metrics
- No merged PRs in 30d
Description
Hi there 👋 , thanks for this amazing tool, it have really changed the way i work
this issue is something thats been bugging me from time to time
i am using stack layout since i want my windows stacked on top of each other in a space, the problem is , when i switch to another space (i am not using yabai for switching spaces, i am using macs mission control keyboard shortcut) and come back to the original space from where i switched , the next window in the stack is focused in that space.
for example, consider two spaces:-
space 1 :- vscode window 1 , vscode window 2, postman window
space 2: - vscode window 3, vscode window 4, chrome window
consider we are in space 1 now and vscode window 1 is in focus and is in top of the stack, then when i switch to space 2, and come back to space 1, vscode window 2 is focused instead of vscode window 1, and then when i switch to space 2 again , vscode window 4 is focused instead of vscode 3,
i only observed this behaviour with multiple windows of vscode, and is only present when multiple windows of the same application is present in a space, which means if postman window is in focus on space 1 and i go to space 2 and come back to space 1 , postman window will be in focus as expected
any idea why this is happening ?
here is my yabairc
```
# bsp, stack or float
yabai -m config layout stack
yabai -m space --layout stack
# Set default behavior for new windows
yabai -m config window_placement second_child
yabai -m config window_follows_mouse focus
# spaces
yabai -m space 1 --label app1
yabai -m space 2 --label app2
yabai -m space 3 --label app3
yabai -m space 4 --label slack
yabai -m space 5 --label finder
yabai -m space 6 --label chrome-personal
yabai -m space 7 --label chrome-work
# app ignores
yabai -m rule --add app="^Calculator$" manage=off
# app assigns
yabai -m rule --add app="Code" title=".*app1.*" space=app1
yabai -m rule --add app="Code" title=".*app2.*" space=app2
yabai -m rule --add app="Code" title=".*app3.*" space=app3
```
my skhdrc :-
```
# Change focus between external displays (top and bottom)
cmd - i : yabai -m display --focus north && yabai -m window --focus stack.recent
cmd - m : yabai -m display --focus south && yabai -m window --focus stack.recent
# Move window to prev and next space
shift + alt - p : yabai -m window --space prev;
shift + alt - n : yabai -m window --space next;
# Move window to space
shift + alt - 1 : yabai -m window --space 1;
shift + alt - 2 : yabai -m window --space 2;
shift + alt - 3 : yabai -m window --space 3;
shift + alt - 4 : yabai -m window --space 4;
shift + alt - 5 : yabai -m window --space 5;
shift + alt - 6 : yabai -m window --space 6;
shift + alt - 7 : yabai -m window --space 7;
# Start / Stop yabai
ctrl + alt - y : yabai --restart-service
# Start / Stop skhd
ctrl + alt - s : skhd --restart-service
# Focus the next window of the same application in the stack
cmd - j : yabai -m window --focus stack.next || yabai -m window --focus stack.first
# Focus the previous window of the same application in the stack
cmd - k : yabai -m window --focus stack.prev || yabai -m window --focus stack.last
```
thanks in advance
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the issue with yabai's stack layout, macOS Mission Control space switching, and multiple VS Code windows in each space; compare that with a space containing one Postman window. No source file or test is named, so trace the window-focus behavior from the stack layout and space-switching entry points, and consider the issue done when the previously focused window remains focused after returning to a space.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, macos
- Domain
- desktop, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100