src/preferences/settings-window/tabs/controls/NativeHotkeyResolverSpecs.md
AltTab triggers its switcher via a Carbon RegisterEventHotKey. A native macOS symbolic hotkey
(⌘⇥ / ⌘⇧⇥ / ⌘`), when enabled, is consumed by the Dock/WindowServer before any app-level
Carbon hotkey — so binding ⌘⇥ to AltTab requires disabling the corresponding native one.
NativeHotkeyResolver.resolve is the pure kernel for that decision: given the configured shortcuts
(as ShortcutSnapshot value records) and the modifier flags of the active hold-shortcuts, it
returns disjoint disable / enable sets over CGSSymbolicHotKey. ControlsTab.toggleNativeCommandTabIfNeeded
is a thin adapter that builds the inputs from ControlsTab.shortcuts and applies the result via
setNativeCommandTabEnabled.
The kernel encodes one invariant the previous in-place code got wrong (issue #5653): a single
shortcut can overlap multiple native predicates and must contribute to all of them. ⌘⇥ matches
.commandTab exactly and .commandShiftTab via combinedModifiersMatch whenever a hold-shortcut
carries shift (the user's second-shortcut scenario). The previous .first { … } over a dictionary
of predicates picked one and dropped the others, with the pick varying per process (Swift dictionary
iteration order isn't stable across launches) — leaving native ⌘⇥ enabled for whole sessions.
disable; nothing
is dropped. The enable set is the complement over CGSSymbolicHotKey.allCases..commandTab implicitly disables .commandShiftTab too, so the native
reverse switcher doesn't fire while AltTab owns ⌘⇥.combinedModifiersMatch previously read ControlsTab.shortcuts to find the hold
modifiers; the kernel takes them as an explicit holdShortcutModifiers: [UInt32] parameter, so the
resolver is independent of any global state.ShortcutSnapshot uses UInt32 for both modifiers and keycode (no
ShortcutRecorder / Shortcut types) so the kernel file compiles in the unit-tests target.Mirrors NativeHotkeyResolverTests.swift 1:1.
.commandTab and .commandShiftTab must end up disabled, regardless of which
predicate the ⌘⇥ snapshot was visited under first..commandKeyAboveTab is disabled.