Reveal tray icons only for the moment a menu is opened

Keeping every icon on the menu bar for as long as the panel was open
looked cluttered. Reveal them just long enough to open the clicked
item's menu, then hide again, so the panel stays clean.

💘 Generated with Crush

Assisted-by: Crush:deepseek-v4.1-flash
This commit is contained in:
2026-09-27 02:47:20 +08:00
parent 61d2689cbc
commit 9c5416d27e
3 changed files with 32 additions and 26 deletions
+7 -6
View File
@@ -134,12 +134,13 @@ preferred position controls where the hidden/kept boundary lands:
- Verified with `--diag-hide` across positions 100–400. Below ~200 Wi-Fi gets
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` (`kAXPressAction`, then
`kAXShowMenuAction`). Because a hidden item sits off-screen, its menu would
open off-screen; `AppDelegate` therefore calls `MenuBarHider.suspend()`
(`popoverWillShow`) to reveal items while the panel is open and `resume()`
0.6s after `popoverDidClose`. `suspend`/`resume` do not change the user's
`enabled` preference.
- 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.
- **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.