Allow user to configure push-to-talk shortcut from panel#16
Allow user to configure push-to-talk shortcut from panel#16vikvang wants to merge 1 commit intofarzaa:mainfrom
Conversation
The push-to-talk keyboard shortcut was hardcoded to Ctrl+Option. Users may prefer a different modifier combination to avoid conflicts with other apps or match their muscle memory. - Make ShortcutOption String-backed and CaseIterable so choices can be persisted to UserDefaults and enumerated in the picker UI - Change currentShortcutOption from a static let to a computed property that reads the user's preference (defaulting to Ctrl+Option) - Add a dropdown shortcut picker to the companion panel, styled to match the existing model picker - Update the instruction text to reflect the currently selected shortcut - Reset the monitor's pressed state on shortcut change to prevent the old combo from getting stuck in a pressed state Co-Authored-By: Oz <oz-agent@warp.dev>
|
Pulled this in, switching to Shift+Fn worked well for me. |
|
Hi, BuddyPushToTalkShortcut.shortcutTransition now reads UserDefaults via currentShortcutOption on every global key event, potentially multiple times per event. This adds avoidable work on the CGEvent tap hot path and can increase input latency while the monitor is running. Severity: remediation recommended | Category: performance How to fix: Cache option; update on change Agent prompt to fix - you can give this to your LLM of choice:
We noticed a couple of other issues in this PR as well - happy to share if helpful. Found by Qodo. Free code review for open-source maintainers. |
|
Hi, selectedPushToTalkModifierCombination is publicly settable, so it can be mutated without persisting to UserDefaults or resetting the monitor pressed state. This can desynchronize the UI selection from the actual shortcut behavior and can reintroduce stuck-pressed state if changed while pressed. Severity: remediation recommended | Category: maintainability How to fix: Make selection setter-only API Agent prompt to fix - you can give this to your LLM of choice:
Spotted by Qodo code review - free for open-source projects. |
Summary
The push-to-talk keyboard shortcut was hardcoded to Ctrl+Option. Users may prefer a different modifier combination to avoid conflicts with other apps or match their muscle memory. This PR makes it user-configurable via a dropdown picker in the companion panel.
Changes
BuddyDictationManager.swift
ShortcutOptionaString-backed,CaseIterableenum so it can be persisted to UserDefaults and iterated in the pickerpickerLabelproperty for human-readable display in the dropdowncurrentShortcutOptionfrom a staticletto a computed property that reads the user's preference from UserDefaults (defaulting to Ctrl+Option)pushToTalkDisplayTextandpushToTalkTooltipTextcomputed so they reflect the current shortcutCompanionManager.swift
selectedPushToTalkModifierCombinationpublished property backed by UserDefaultssetSelectedPushToTalkModifierCombination()setter that persists the choice and resets the monitor's pressed stateCompanionPanelView.swift
GlobalPushToTalkShortcutMonitor.swift
resetShortcutPressedState()to prevent the old shortcut from getting stuck in a pressed state when the user switches combinationsHow it works
The shortcut takes effect immediately — no app restart needed. Each CGEvent tap callback reads
currentShortcutOption(which reads from UserDefaults), so changing the preference is picked up on the next keypress automatically.Co-Authored-By: Oz oz-agent@warp.dev