Add a system-wide hotkey to show and hide cmux windows
Summary
- Add a configurable system-wide hotkey that shows or hides all cmux windows, similar to iTerm2's app hotkey
- Back the shortcut itself with
KeyboardShortcutSettings/settings.jsonsupport while keeping the enabled flag inUserDefaults - Register the global hotkey with Carbon
RegisterEventHotKey, so no Accessibility permission is required - Add a new Settings > Global Hotkey section for enabling the feature and recording the shortcut
- Preserve invalid legacy or settings-file bindings for display/migration, but avoid registering invalid or conflicting global shortcuts
- Closes #2362
Testing
- Built the tagged debug app with
./scripts/reload.sh --tag issue-2362-system-wide-hotkey - Did not run local automated tests per repo policy
- Manual verification in this pass was limited to a successful tagged Debug app build
Demo Video
- Not included in this pass
Known Notes
- The global hotkey now shares the normal shortcut source of truth (
KeyboardShortcutSettings), includingsettings.jsonoverrides - Invalid or conflicting global hotkey bindings are left visible if they come from legacy storage or
settings.json, but cmux will not register them until they are changed to a valid non-conflicting shortcut
Review Trigger (Copy/Paste as PR comment)
@codex review
@coderabbitai review
@greptile-apps review
@cubic-dev-ai review
Checklist
- I tested the change locally
- I added or updated tests for behavior changes
- I updated docs/changelog if needed
- I requested bot reviews after my latest commit (copy/paste block above or equivalent)
- All code review bot comments are resolved
- All human review comments are resolved
[!NOTE]
Medium Risk
Touches keyboard shortcut persistence/matching and introduces Carbon-level global hotkey registration, which can affect input handling across layouts and app/window visibility behavior if edge cases are missed.
Overview
Adds a new system-wide “Show/Hide All Windows” hotkey backed by Carbon RegisterEventHotKey, with a Settings > Global Hotkey section to enable/disable it and record the shortcut.
Extends KeyboardShortcutSettings with a showHideAllWindows action and introduces SystemWideHotkeyController/SystemWideHotkeySettings to manage enablement, legacy migration, and registration; invalid/chord/conflicting shortcuts are preserved for display but not registered, and chord-prefix handling explicitly excludes this action.
Refactors shortcut matching/recording to carry and use recorded keyCode (plus shared matches(...) helpers) to improve layout/input-source behavior and to validate system-wide conflicts; adds recorder activity tracking to temporarily unregister the global hotkey while recording.
Includes supporting updates: new localizations, settings schema/docs (web/data), new unit tests around matching and migration, and a small zsh integration change to delay restoring TERM until the first prompt.
Reviewed by Cursor Bugbot for commit d03a82a68182574da656983d4099aeff883d63c4. Bugbot is set up for automated code reviews on this repo. Configure here.