Issue #1 — core reliability hardening
Fixing the bullets from issue #1 that are still real. The "instant switching /
AppleScript" bullet is dropped: a61f1e1 deleted that machinery entirely.
Plan
- Shortcut persistence: keycode
0(A) is treated as "unset", so⌘⇧Areverts to⌘⇧Bon relaunch. Move load/save into a testableGlobalShortcutvalue type keyed on presence of the default, not on a non-zero value. - Hotkey registration:
RegisterEventHotKey/InstallEventHandlerreturn statuses are discarded, so a conflict fails silently. Makeregisterthrow, roll back a half-installed handler, and mapeventHotKeyExistsErrto a friendly "already in use". - Surface the hotkey failure in the UI (Preferences row + the menu hint line) instead of only the log.
- Default browser switching: report a real failure reason instead of silently leaving the "Enable" button sitting there.
- Regression coverage for the shortcut load/save rules, incl. the
Acase. - Wire new sources/tests into
build.shandtest.sh.
Review
Verified in the shipping binary: with shortcutKeyCode=0 stored, the app logs
Registering hotkey: keyCode=0, carbonModifiers=768 (⌘⇧A). Before the fix it
would have logged keyCode=11 (⌘⇧B).
Not verified end-to-end: the hotkey conflict path. Carbon let a second
MenuBrowser instance register the same hotkey without returning
eventHotKeyExistsErr, so a real conflict couldn't be forced locally. The
status is now checked and mapped, but the "already in use" branch has only
been exercised by reading, not by running.
Left alone: the "instant switching / AppleScript" bullet in issue #1 — a61f1e1 deleted that machinery, so there is nothing left to harden.