Add ctrl+alt+r global hotkey to start/stop recording - #14
Open
Broyojo wants to merge 5 commits into
Open
Conversation
- Retry the OBS websocket connection with a readiness probe, since OBS may still be starting up when DuckTrack launches it - Launch OBS via `open -a` on macOS so permission prompts work, and quit it gracefully via AppleScript (terminating the `open` process does nothing) - Continue with the current OBS profile instead of crashing when the computer_tracker profile can't be created or switched to - Show a one-time notice on macOS explaining the required permissions Adapted from the huyouare/DuckTrack fork. Co-authored-by: Jesse Hu <3528340+huyouare@users.noreply.github.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The hotkey listener runs on a pynput listener thread, so it emits a Qt signal to make toggle_record run on the main thread. Left/right modifier variants (ctrl_l, alt_r, ...) are folded into their generic key so combinations match across platforms. Feature adapted from the jxbb824/DuckTrack fork, reimplemented with the existing pynput-based listener instead of the `keyboard` library, which requires root on macOS and Linux. Co-authored-by: Xirui Jiang <xirui@umich.edu> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Held modifiers change the character pynput reports (ctrl+r arrives as '\x12' on Windows, alt+r as '®' on macOS), which breaks naive key-set matching. GlobalHotKeys handles this internally for the record hotkey, and KeyCombinationListener now normalizes via listener.canonical() for the shift+esc playback combo. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
pynput's listener.canonical() converts special keys like Key.esc into bare vk KeyCodes, so canonicalizing only the incoming presses broke matching against combos stored as Key values. Canonicalize the combo keys at registration time too, so both sides compare in canonical form. Caught by the new tests, which cover generic and left/right modifier variants, shifted characters, release handling, and the <ctrl>+<alt>+r hotkey spec used in app.py. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Collaborator
Author
|
Added unit tests for the combo listener ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a global
ctrl+alt+rhotkey to toggle recording, so you don't have to click the GUI/tray (which pollutes the recording with DuckTrack's own UI interactions).toggle_record_requested) to runtoggle_recordsafely on the main thread.KeyCombinationListenernow folds left/right modifier variants (ctrl_l,alt_r, ...) into their generic key, so combinations match reliably across platforms. This also benefits the existingshift+escplayback stop combo.Notes
app.py) — merge order: Fix OBSSDKRequestError import for newer obsws-python #12 → Make OBS startup and connection more robust #13 → this.events.jsonlright before the recording stops, so playing back such a recording replays them. The same applies to the existingshift+escplayback combo. Trimming trailing hotkey events on stop could be a follow-up.Credit
Feature design from the jxbb824/DuckTrack fork by @jxbb824, including the Qt-signal thread-safety pattern. Reimplemented on the existing pynput listener instead of the fork's
keyboardlibrary, which requires root privileges on macOS/Linux and globally suppresses the combo.🤖 Generated with Claude Code