Explain which menu bar items can be hidden

Hiding other apps' icons worked, but Apple pins Spotlight, Clock, Battery
and Control Center to the right of the menu bar, so a third-party item can
never be placed after them to push them away. Document the real limit so
the behaviour is not mistaken for a bug.

💘 Generated with Crush

Assisted-by: Crush:deepseek-v4.1-flash
This commit is contained in:
2026-09-27 00:35:05 +08:00
parent 8767b73234
commit 92a57308b7
6 changed files with 46 additions and 7 deletions
+8
View File
@@ -165,7 +165,15 @@ final class MenuBarHider: ObservableObject {
/// Create the spacer early (at launch) so it lands as far right as possible.
func prepare() {
guard spacer == nil else { return }
let name = "SimpleTopBarHider"
let key = "NSStatusItem Preferred Position \(name)"
// Seed just left of the hamburger so growing the spacer pushes the
// third-party icons on its left off-screen while ours stays put.
if UserDefaults.standard.object(forKey: key) == nil {
UserDefaults.standard.set(150.0, forKey: key)
}
let item = NSStatusBar.system.statusItem(withLength: 0)
item.autosaveName = name
item.button?.isHidden = true
spacer = item
}