Release all modifiers before sending clean Ctrl+grave sequence
Use explicit keyup ctrl alt super first, then the exact working sequence: keydown ctrl, key grave, keyup ctrl. https://claude.ai/code/session_01XKYC1basxdwtHy71tky7xm
This commit is contained in:
+4
-5
@@ -38,18 +38,17 @@ is_recording = False
|
|||||||
def send_whispr_toggle():
|
def send_whispr_toggle():
|
||||||
"""Send Ctrl+` to OpenWhispr via xdotool.
|
"""Send Ctrl+` to OpenWhispr via xdotool.
|
||||||
|
|
||||||
We first release Alt (which we're physically holding), send Ctrl+grave,
|
Release all held modifiers first, then send the full
|
||||||
then re-press Alt. This way OpenWhispr sees clean Ctrl+` without
|
keydown ctrl, key grave, keyup ctrl sequence cleanly.
|
||||||
the Alt modifier corrupting it.
|
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
["xdotool", "keyup", "alt"],
|
["xdotool", "keyup", "ctrl", "alt", "super"],
|
||||||
timeout=2,
|
timeout=2,
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
)
|
)
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
["xdotool", "key", WHISPR_HOTKEY],
|
["xdotool", "keydown", "ctrl", "key", "grave", "keyup", "ctrl"],
|
||||||
timeout=2,
|
timeout=2,
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user