diff --git a/openwhispr-ptt.py b/openwhispr-ptt.py index e290ad0..4817742 100644 --- a/openwhispr-ptt.py +++ b/openwhispr-ptt.py @@ -2,9 +2,9 @@ """ openwhispr-ptt.py — Push-to-talk wrapper for OpenWhispr -Turns Ctrl+Super (hold) into Ctrl+` toggle pairs: - - Press Ctrl+Super → sends Ctrl+` to START dictation - - Release Ctrl+Super → sends Ctrl+` to STOP dictation +Turns Ctrl+Alt (hold) into Ctrl+` toggle pairs: + - Press Ctrl+Alt → sends Ctrl+` to START dictation + - Release Ctrl+Alt → sends Ctrl+` to STOP dictation Requires: pynput, xdotool Usage: python3 openwhispr-ptt.py @@ -27,10 +27,11 @@ except ImportError: # The key combo YOU hold to talk PTT_MODIFIER = keyboard.Key.ctrl_l -PTT_KEY = keyboard.Key.cmd # Super/Windows key +PTT_KEY = keyboard.Key.alt_l -# Also accept right Ctrl +# Also accept right-hand variants PTT_MODIFIER_ALT = keyboard.Key.ctrl_r +PTT_KEY_ALT = keyboard.Key.alt_r # The key combo OpenWhispr uses (Ctrl+`) # We simulate this via xdotool for reliability with Electron apps @@ -67,7 +68,7 @@ def on_press(key): # Track modifier state — ignore key repeat (already True) if key in (PTT_MODIFIER, PTT_MODIFIER_ALT): ctrl_held = True - elif key == PTT_KEY: + elif key in (PTT_KEY, PTT_KEY_ALT): super_held = True # Start recording when both held and not already recording @@ -87,7 +88,7 @@ def on_release(key): if key in (PTT_MODIFIER, PTT_MODIFIER_ALT): ctrl_held = False released_ptt = True - elif key == PTT_KEY: + elif key in (PTT_KEY, PTT_KEY_ALT): super_held = False released_ptt = True @@ -103,8 +104,8 @@ def main(): print("═══════════════════════════════════════════") print(" OpenWhispr Push-to-Talk") print("═══════════════════════════════════════════") - print(" Hold: Ctrl + Super → start dictation") - print(" Release: Ctrl + Super → stop dictation") + print(" Hold: Ctrl + Alt → start dictation") + print(" Release: Ctrl + Alt → stop dictation") print(" Quit: Ctrl + C") print("═══════════════════════════════════════════") print("Listening...\n")