Hide menu bar icons with a cover instead of moving them off screen

Sliding the icons off the screen meant bringing them all back just to
open one menu, which flickered. Draw a frosted window over the other
apps' icons instead: they keep their real positions, so tapping a tile
opens its menu in place with no reveal, and the cover leaves a gap so
the hamburger is never hidden.

💘 Generated with Crush

Assisted-by: Crush:deepseek-v4.1-flash
This commit is contained in:
2026-09-27 03:06:15 +08:00
parent 2312e09105
commit 3e57efe312
6 changed files with 246 additions and 143 deletions
+15 -21
View File
@@ -23,30 +23,24 @@ permission (System Settings → Privacy & Security → Accessibility). The panel
prompts for it; without it the Menu Bar section is empty and everything else
still works.
## Hiding menu bar items (best-effort)
## Hiding menu bar items
macOS has no public API to move another app's status item. The **Hide items from
the menu bar** toggle uses the spacer technique: a zero-width status item is
created at launch whose length is expanded to push the other icons off-screen so
they only live in this panel. It is **on by default** (the choice is
remembered), always undone on quit, and if the app dies macOS removes the spacer
automatically.
macOS has no public API to move another app's status item. Instead of moving
them, the **Hide items from the menu bar** toggle (on by default, remembered)
draws a frosted **cover** window over the other apps' icons. They keep their real
positions, so tapping a tile in the panel opens that app's menu in the right
place with **no flicker**, and the cover leaves a gap for the hamburger so it is
never hidden.
What it can and cannot hide:
What it does and does not cover:
- It hides **other third-party apps' icons** (cmux, Kapture, WireGuard, input
source, Now Playing, …) so only your apps' icons leave the bar.
- It **keeps Wi-Fi, Spotlight, Clock, Battery and Control Center**. The spacer's
boundary is tuned (preferred position 250) to fall just left of Wi-Fi, so the
Apple items on the right stay visible. macOS reserves that far-right area: a
third-party item can never be placed to the right of it, so those icons cannot
be pushed away even in principle. (Bartender and Ice hit the same wall and
cover the area with their own overlay bar instead.)
- Newly launched apps are placed to the left of the spacer, so they are hidden
automatically.
- Advanced: set `defaults write dev.tzgyn.simpletopbar debug.spacerPos -float <n>`
to move the boundary (larger = keep more icons; > ~400 starts leaking app
icons back into the bar).
- Covers **other third-party apps' icons** (cmux, Kapture, WireGuard, input
source, Now Playing, …).
- Keeps **Wi-Fi, Spotlight, Clock, Battery and Control Center** visible — macOS
reserves that far-right area, so those icons stay put.
- The cover matches the menu bar's frosted look only approximately; over an
unusual wallpaper the covered strip may be slightly visible.
- Turning the toggle off removes the cover immediately; quitting does too.
## Install with Homebrew