`--grid` silently fails on floating window after sleep/wake (stale frame cache)
- Dominant language
- C
- Stars
- 29.6k
- Forks
- 758
- PR merge metrics
- No merged PRs in 30d
Description
Hey there, I just wanted to say upfront that this issue is written by claude, but that's not because I found a bug with it - it just helped me diagnose it and find a solution, and with my lack of experience with yabai it was best equiped to describe the problem I think.
So, sorry for the AI-generated text, I understand if you want to ignore it!
---
## Problem
`yabai -m window --grid` silently fails to reposition a floating window after a macOS sleep/wake cycle when the window was previously moved off-screen with `--move abs:0:-10000`. The command exits successfully (no error) but the window frame does not update.
`--move abs` still works correctly in the same state.
## Context
I use a "quake terminal" script bound to F1 via skhd. It toggles a sticky floating kitty window by:
- **Hide**: `yabai -m window $ID --move abs:0:-10000` (moves off-screen)
- **Show**: `yabai -m window $ID --grid 2:1:0:0:1:1` (snaps to top half)
- **Detection**: checks `frame.y < 0` to determine visibility
This works perfectly under normal conditions. After a sleep/wake cycle, the toggle breaks — F1 no longer brings the window back.
## Diagnosis
After sleep/wake, querying the window shows:
```json
{
"frame": {
"x": 0.0000,
"y": -10000.0000,
"w": 3840.0000,
"h": 1064.0000
},
"is-visible": true,
"has-focus": true,
"is-floating": true,
"is-sticky": true
}
```
The window is visually on-screen (macOS moved it back during wake), but yabai's frame cache still reports `y: -10000`. This is a stale state.
In this stale state:
- `--grid 2:1:0:0:1:1` → **silently does nothing**, frame stays at `y: -10000`
- `--move abs:0:0` → **works**, frame updates to `y: 31` (menu bar offset)
To confirm this is sleep-specific, the same sequence without sleep works fine:
```bash
# Without sleep: --grid correctly moves from y:-10000
yabai -m window $ID --move abs:0:-10000 # hide
yabai -m window $ID --grid 2:1:0:0:1:1 # show → works, y becomes 31
# After sleep/wake: --grid fails
yabai -m window $ID --grid 2:1:0:0:1:1 # show → no-op, y stays -10000
```
## Environment
- macOS 26 (Tahoe)
- yabai (homebrew)
- Display: 3840×2160
## Workaround
Adding `--move abs:0:0` before `--grid` in the show path resets the stale frame and allows `--grid` to work:
```bash
yabai -m window "$WIN_ID" --move abs:0:0
yabai -m window "$WIN_ID" --grid 2:1:0:0:1:1
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the sleep/wake sequence with the floating Kitty window, first using `--move abs:0:-10000` and then `--grid 2:1:0:0:1:1`, and compare the reported frame with the workaround. Done means `--grid` updates the window after wake without requiring a preceding `--move abs:0:0`.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, macos
- Domain
- desktop-dev, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100