asmvik / asmvik/yabai

Incorrect stack window is focused

Open
#2,350 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
29.6k
Forks
750
PR merge metrics
No merged PRs in 30d

Description

## Description
The wrong stack window is focused in the following use case:
1. The command ```yabai -m window --stack ``` is used to stack the current window on top of another window.
2. A command such as ```yabai -m window --focus west``` is used to change focus to a different window that is not in the stack.
3. A command such as ```yabai -m window --focus east``` is used to change focus back to the stack.

**Expected result**
The window at the front of the stack is focused.

**Actual result**
The next window in the stack is focused instead of the one that is currently at the front.

**Additional notes**
The bug doesn't seem to occur if the windows change focus through mouse clicks or if the windows are stacked through the use of "mouse_drop_action".

Tested on yabai-v7.1.1

## Example

https://github.com/user-attachments/assets/61f58496-115b-483f-802e-cab951f0603a

The video uses the following command in the terminal:
```
sleep 1; yabai -m window --stack south; \
sleep 1; yabai -m window --focus west; \
sleep 1; yabai -m window --focus east;
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue using `yabai -m window --stack south`, then the `--focus west` and `--focus east` commands from the example. Trace the handling of stack and focus changes, comparing command-driven focus with mouse-driven focus. Done means returning focus to the stack selects the window currently at the front, rather than the next window.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, macos
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.