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

This reverts commit 3e57efe312.
This commit is contained in:
2026-09-27 10:13:10 +08:00
parent 3e57efe312
commit 569abe967f
6 changed files with 143 additions and 246 deletions
+21 -15
View File
@@ -23,24 +23,30 @@ 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
## Hiding menu bar items (best-effort)
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.
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.
What it does and does not cover:
What it can and cannot hide:
- 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.
- 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).
## Install with Homebrew