After a window with focus is minimized, yabai still reports that the window has focus.
- Dominant language
- C
- Stars
- 29.6k
- Forks
- 750
- PR merge metrics
- No merged PRs in 30d
Description
You can easily reproduce this issue using the following script
```zsh
# Get the current window's ID and has-focus attribute
window_info=$(yabai -m query --windows --window)
window_id=$(echo "$window_info" | jq '.id')
window_focus=$(echo "$window_info" | jq '."has-focus"')
# Print the window's ID and has-focus attribute
echo "Window ID: $window_id"
echo "Has Focus: $window_focus"
# Minimize the window using the yabai command
yabai -m window "$window_id" --minimize
# Wait for 1.5 seconds
sleep 1.5
# Query the window's has-focus attribute
window_focus_after=$(yabai -m query --windows --window "$window_id" | jq '."has-focus"')
# Print the window's has-focus attribute after minimizing
echo "Has Focus After Minimize: $window_focus_after"
```
```
❯ nix-shell -p jq
[nix-shell:~]$ # Get the current window's ID and has-focus attribute
window_info=$(yabai -m query --windows --window)
window_id=$(echo "$window_info" | jq '.id')
window_focus=$(echo "$window_info" | jq '."has-focus"')
# Print the window's ID and has-focus attribute
echo "Window ID: $window_id"
echo "Has Focus: $window_focus"
# Minimize the window using the yabai command
yabai -m window "$window_id" --minimize
# Wait for 1.5 seconds
sleep 1.5
# Query the window's has-focus attribute
window_focus_after=$(yabai -m query --windows --window "$window_id" | jq '."has-focus"')
# Print the window's has-focus attribute after minimizing
echo "Has Focus After Minimize: $window_focus_after"
Window ID: 979
Has Focus: true
Has Focus After Minimize: true
[nix-shell:~]$
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Run the provided zsh reproduction on macOS and compare the focus value before and after `yabai -m window --minimize`. Trace the `query --windows --window` and `window --minimize` entry points to determine why the minimized window remains reported as focused. Done means the follow-up query reports `has-focus: false` after minimization.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, zsh
- Domain
- desktop, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100