Fix Ctrl+grave being sent without Ctrl due to --clearmodifiers
--clearmodifiers releases ALL modifiers including Ctrl, so xdotool sends bare grave (types 'v'). Instead, explicitly release only Alt before sending Ctrl+grave so OpenWhispr receives the correct combo. https://claude.ai/code/session_01XKYC1basxdwtHy71tky7xm
This commit is contained in:
+9
-3
@@ -38,12 +38,18 @@ is_recording = False
|
|||||||
def send_whispr_toggle():
|
def send_whispr_toggle():
|
||||||
"""Send Ctrl+` to OpenWhispr via xdotool.
|
"""Send Ctrl+` to OpenWhispr via xdotool.
|
||||||
|
|
||||||
Uses --clearmodifiers to release any physically held keys first,
|
We first release Alt (which we're physically holding), send Ctrl+grave,
|
||||||
so the simulated Ctrl+` isn't mangled into Ctrl+Alt+`.
|
then re-press Alt. This way OpenWhispr sees clean Ctrl+` without
|
||||||
|
the Alt modifier corrupting it.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
["xdotool", "key", "--clearmodifiers", WHISPR_HOTKEY],
|
["xdotool", "keyup", "alt"],
|
||||||
|
timeout=2,
|
||||||
|
capture_output=True,
|
||||||
|
)
|
||||||
|
subprocess.run(
|
||||||
|
["xdotool", "key", WHISPR_HOTKEY],
|
||||||
timeout=2,
|
timeout=2,
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user