feat(macos): manage menu bar "Always Show" dropdown for visible modules#70
Merged
Conversation
The Menu Bar catalog only controlled the visibility checkbox (`NSStatusItem Visible X`). The mode dropdown (Show When Active vs Always Show in Menu Bar) was left at macOS's default of "Show When Active", which hides Sound/Bluetooth/Wi-Fi/Battery from the menu bar except while the underlying state is active. Add the int-typed mode key (`com.apple.controlcenter` / bare module name) with value 18 = Always Show in Menu Bar for the four modules already set visible. Modules with Visible=false don't need the mode key — the checkbox hides them entirely. Verified empirically on macOS Sequoia: `defaults write com.apple.controlcenter Sound -int 18 && killall ControlCenter` flips the dropdown to "Always Show in Menu Bar".
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
5 tasks
fullstackjam
added a commit
that referenced
this pull request
May 16, 2026
…ong values) (#73) #70 added int catalog entries for Sound/Bluetooth/WiFi/Battery written to the main `com.apple.controlcenter` domain. On macOS Sequoia those keys are a silent no-op there — the actually-respected state for the 3-way menu bar dropdown (Always Show / Show When Active / Don't Show) lives in the ByHost scope (`defaults -currentHost`). Result: user's published config carried `Sound=18` in the main domain, install dutifully wrote it, the dropdown never changed, and openboot's diff thought every reinstall needed to "fix" the visibility every time. This change: - Adds a `Host` field to `macos.Preference`, `snapshot.MacOSPref`, and `config.RemoteMacOSPref` (default "" = main domain, "currentHost" = ByHost). Propagated through Configure, CaptureMacOSPrefs, the installer/sync plan builders, snapshot import, and the diff. - `Configure` and `CaptureMacOSPrefs` pass `-currentHost` to `defaults` when Host=="currentHost". Dry-run output prefixes "(ByHost)" so users can see the scope. - The diff identity key now includes Host — the same (Domain, Key) in main vs ByHost are independent prefs and must not satisfy each other. - Catalog: drops #70's broken `Sound/Bluetooth/WiFi/Battery=18` main-domain entries. Adds one verified entry: `Sound=18` with Host="currentHost". Bluetooth/WiFi/Battery dropped from int management — empirical testing showed they use a different ByHost scheme (24 vs 18, checkbox-only vs 3-way) that needs separate investigation. Values empirically mapped on macOS Sequoia by toggling the Sound dropdown in System Settings and reading `defaults -currentHost read com.apple.controlcenter Sound`: 2 = Show When Active (also the default when key is absent) 8 = Don't Show in Menu Bar 18 = Always Show in Menu Bar Also: bulk-rewrites positional `Preference{...}` literals in categories.go to add the trailing empty Host field, so existing entries keep their main-domain semantics.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
NSStatusItem Visible X); the mode dropdown was left at macOS's default of "Show When Active", so Sound/Bluetooth/Wi-Fi/Battery would still hide themselves when the underlying state was inactive.com.apple.controlcenter/<Module>(int, value18= "Always Show in Menu Bar") for the four modules currently set visible. Modules withVisible=falsedon't need the mode key — the checkbox already hides them entirely.Test plan
go test ./internal/...(L1 incl. archtest + categories_test) — greengo vet ./...— cleandefaults write com.apple.controlcenter Sound -int 18 && killall ControlCenterflips the dropdown to "Always Show in Menu Bar"