Skip to content

feat(macos): manage menu bar "Always Show" dropdown for visible modules#70

Merged
fullstackjam merged 2 commits into
mainfrom
feat/menu-bar-always-show
May 16, 2026
Merged

feat(macos): manage menu bar "Always Show" dropdown for visible modules#70
fullstackjam merged 2 commits into
mainfrom
feat/menu-bar-always-show

Conversation

@fullstackjam

Copy link
Copy Markdown
Member

Summary

  • The Menu Bar catalog only managed the visibility checkbox (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.
  • Add com.apple.controlcenter / <Module> (int, value 18 = "Always Show in Menu Bar") for the four modules currently set visible. Modules with Visible=false don't need the mode key — the checkbox already hides them entirely.

Test plan

  • go test ./internal/... (L1 incl. archtest + categories_test) — green
  • go vet ./... — clean
  • Empirically verified on macOS Sequoia: defaults write com.apple.controlcenter Sound -int 18 && killall ControlCenter flips the dropdown to "Always Show in Menu Bar"

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

codecov Bot commented May 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@fullstackjam
fullstackjam merged commit ed1c8b4 into main May 16, 2026
13 checks passed
@fullstackjam
fullstackjam deleted the feat/menu-bar-always-show branch May 16, 2026 17:06
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant