Skip to content

Global hotkey opens the prompt menu (default ⌃⌥⌘P)#1

Merged
fabapp2 merged 1 commit into
mainfrom
feat/global-hotkey
May 5, 2026
Merged

Global hotkey opens the prompt menu (default ⌃⌥⌘P)#1
fabapp2 merged 1 commit into
mainfrom
feat/global-hotkey

Conversation

@fabapp2

@fabapp2 fabapp2 commented May 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Default global shortcut ⌃⌥⌘P now opens the menu bar dropdown from anywhere — no more reaching for the menu bar each time.
  • New HotkeySpec value type (keycode + modifier bits + display glyph) and GlobalHotkey Carbon-based registrar.
  • The hotkey glyph is shown in the menu header so the binding is discoverable.

Why Carbon

RegisterEventHotKey works without any permission grant. The alternative (CGEventTap) would need Accessibility access on top of what pasting already requires, which is a worse onboarding story.

Why ⌃⌥⌘P as default

Picked to avoid conflicts with ⌥⌘P (printing dialogs across the OS), ⇧⌘P (VS Code / Sublime / Notion command palettes), and ⌥⌘Space (Spotlight in some configs). User-configurable hotkey via Settings UI is the next step.

Tests

  • HotkeySpecTests (4): default keycode + modifier bits, display string ordering matches Apple HIG (⌃⌥⇧⌘), Codable round-trip.

Total project tests: 25 passing.

Test plan

  • swift build clean
  • swift test all green (25/25)
  • App installs and launches
  • Press ⌃⌥⌘P from any app → menu drops down at status icon
  • Menu header shows "promptLM · ⌃⌥⌘P"
  • Pick a prompt with placeholders → form opens, fill, Insert → text pastes at the original cursor (Accessibility permission required)

🤖 Generated with Claude Code

- HotkeySpec: keycode + modifier bits, Codable, with display string in
  Apple HIG modifier order (⌃⌥⇧⌘ then key glyph). Default ⌃⌥⌘P picked
  to avoid conflicts with ⌥⌘P (printing) and ⇧⌘P (command palettes).
- GlobalHotkey: thin Carbon RegisterEventHotKey wrapper. One hotkey at a
  time, single shared event handler installed lazily, action dispatched
  to the main queue. Carbon over CGEventTap because the latter would
  require Accessibility permission on top of what pasting already needs.
- StatusBarController registers the default on launch, opens the status
  menu via statusItem.button.performClick(nil) when fired, and shows
  the hotkey glyph in the menu header so the binding is discoverable.
- 4 tests cover the spec defaults, display ordering, and Codable round-trip.

Configurable hotkey via Settings UI is the next step.
@fabapp2
fabapp2 merged commit 3333926 into main May 5, 2026
1 check passed
@fabapp2
fabapp2 deleted the feat/global-hotkey branch May 5, 2026 14:32
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