Shorten the icon reveal when opening a tray menu

The menu is its own window anchored where the item was revealed, so it
survives if the bar re-hides immediately. Revealing for ~0.3s instead of
over a second makes the flash far less noticeable while still opening
the menu in view.

💘 Generated with Crush

Assisted-by: Crush:deepseek-v4.1-flash
This commit is contained in:
2026-09-27 02:53:41 +08:00
parent 9c5416d27e
commit 2312e09105
4 changed files with 58 additions and 9 deletions
+10 -6
View File
@@ -135,12 +135,16 @@ preferred position controls where the hidden/kept boundary lands:
hidden too; above ~300 app icons (Now Playing, TextInput) leak back.
- `debug.spacerPos` (Double) overrides the seed for tuning without rebuilding.
- Pressing a tray tile calls `MenuBarItemManager.press`. A hidden item sits
off-screen, and its menu would open off-screen too, so press briefly
`suspend()`s the hider, waits ~0.18s for the layout to settle, performs the
accessibility action (`kAXPressAction`, then `kAXShowMenuAction`), and
`resume()`s ~1s later. The reveal is momentary, not for the whole time the
panel is open. macOS does not let us place or anchor another app's menu
anywhere else, so a momentary reveal is the only way to show it in view.
off-screen, and its menu opens off-screen too (verified with `--diag-press`:
the menu window lands at negative x). So press briefly `suspend()`s the hider,
waits ~0.2s for the layout to settle, performs the accessibility action
(`kAXPressAction`, then `kAXShowMenuAction`), and `resume()`s ~0.1s later. The
menu is its own window anchored at the item's on-screen spot, so it survives
re-hiding.
- **Cannot reveal a single icon.** The spacer hides a contiguous block to its
left, so a press can only reveal the whole block. Isolating one item would
need either per-item ordering control (not available) or covering the icons
with an overlay window instead of moving them off-screen.
- **Order matters**: `AppDelegate` must call `setupStatusItem()` *before*
`MenuBarHider.shared.prepare()`. If the hider contracts the bar first, the
hamburger is created into the collapsed space and lands off-screen.