Keep Wi-Fi visible when hiding other menu bar icons

Hiding pushed Wi-Fi off along with the third-party app icons. Tune the
spacer boundary to sit just left of Wi-Fi so apps disappear while the
Apple Wi-Fi, Spotlight, Clock, Battery and Control Center icons remain.

💘 Generated with Crush

Assisted-by: Crush:deepseek-v4.1-flash
This commit is contained in:
2026-09-27 00:39:00 +08:00
parent 92a57308b7
commit 5a4e2fbda2
4 changed files with 31 additions and 19 deletions
+7 -4
View File
@@ -167,10 +167,13 @@ final class MenuBarHider: ObservableObject {
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)
// The boundary between "hidden" and "kept" falls just left of Wi-Fi at
// ~250, so the other apps hide while Apple's Wi-Fi/Clock/Battery/Control
// Center/Spotlight stay visible. `debug.spacerPos` overrides the seed.
if let override = UserDefaults.standard.object(forKey: "debug.spacerPos") as? Double {
UserDefaults.standard.set(override, forKey: key)
} else if UserDefaults.standard.object(forKey: key) == nil {
UserDefaults.standard.set(250.0, forKey: key)
}
let item = NSStatusBar.system.statusItem(withLength: 0)
item.autosaveName = name