Skip to content

Add menu actions and shortcuts for last transcription and history#141

Open
prateek wants to merge 3 commits into
matthartman:mainfrom
prateek:prateek/plan-a-menu-shortcuts
Open

Add menu actions and shortcuts for last transcription and history#141
prateek wants to merge 3 commits into
matthartman:mainfrom
prateek:prateek/plan-a-menu-shortcuts

Conversation

@prateek

@prateek prateek commented Jun 30, 2026

Copy link
Copy Markdown

Closes #140.

What changed

Adds two menu bar actions:

  • Copy Last Transcription copies the most recent dictation result to the pasteboard. It uses cleaned text when cleanup ran, otherwise raw text, and stays disabled until a dictation exists.
  • History opens Settings > History.

Adds optional global shortcuts for both actions under Settings > General > Shortcuts. Both are unset by default.

Implementation notes

  • Stores AppState.lastTranscription at the dictation finalization path in processRecordingResult. Empty final text does not erase the previous value.
  • Adds one-shot ChordAction cases for copy and history. ChordEngine fires them on the key-down edge only, so held keys, auto-repeat, and superset chord release do not double-fire.
  • Routes one-shot hotkeys through HotkeyMonitor.onSimpleAction back to AppState.
  • Lets ShortcutRecorderView render optional chords as "Record Shortcut".

Testing

  • xcodebuild -project GhostPepper.xcodeproj -scheme GhostPepper -destination 'platform=macOS' build succeeds on macOS 14.
  • Adds tests for one-shot firing, repeat suppression, superset collapse, overlapping chords, default-unset bindings, binding updates, last transcription capture, and pasteboard no-op without a value.
  • Manual checks covered the disabled copy item before first dictation, copy after dictation, History navigation, shortcut firing, and shortcut persistence across relaunch.

prateek and others added 3 commits June 30, 2026 01:45
Add three local menu-bar affordances and make two of them user-configurable
global hotkeys, reusing the existing ChordAction / HotkeyMonitor / ChordEngine /
ShortcutRecorderView system:

- Copy Last Transcription: AppState.lastTranscription captured once at the
  dictation-finalization funnel (cleaned-or-raw, dictation only); menu button
  disabled until the first dictation.
- History: opens Settings -> History (.transcriptionLab).
- Configurable shortcuts: new one-shot ChordAction cases .copyLastTranscription
  / .openHistory fire on the chord's key-down edge via a new ChordEngine
  .fireSimpleAction effect (latched against double-fire) and a HotkeyMonitor
  onSimpleAction callback that hops to @mainactor. Unset by default; two
  ShortcutRecorderView rows added to Settings -> General.

Tests: ChordEngine one-shot fire/repeat-suppression/re-entry, AppState funnel
capture, default-unset bindings, and pasteboard no-op.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the firedSimpleAction latch with previous-pressed-set edge detection:
a simple action fires only when its chord is completed by adding a key, not
when a larger held set collapses back onto it. This also closes the
overlapping-chord case (one simple chord a strict superset of another), where
releasing the extra key would re-fire the smaller chord. Stateless and uniform
across the event and polling-sync paths.

Also: keep the prior lastTranscription on an empty cleanup result; drop a dead
assignment and trim redundant comments. Adds an overlapping-chord regression
test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@prateek prateek changed the title Add Copy Last Transcription and History menu items with configurable global shortcuts Add menu actions and shortcuts for last transcription and history Jun 30, 2026
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.

Add menu actions for last transcription and history

1 participant