@@ -60,6 +60,13 @@ def __init__(self, config: AppConfig) -> None:
6060 keycodes = config .record_hotkey_keycodes ,
6161 debounce_s = config .button_debounce_ms / 1000.0 ,
6262 )
63+ self ._recording_submit_listener : KeyboardHotkeyListener | None = None
64+ if config .recording_submit_keycode is not None :
65+ self ._recording_submit_listener = KeyboardHotkeyListener (
66+ on_hotkey = self ._on_recording_submit_press ,
67+ keycodes = (config .recording_submit_keycode ,),
68+ debounce_s = config .button_debounce_ms / 1000.0 ,
69+ )
6370 self ._stop_event : threading .Event = threading .Event ()
6471 self ._transcribe_lock : threading .Lock = threading .Lock ()
6572 self ._workers_lock : threading .Lock = threading .Lock ()
@@ -69,14 +76,18 @@ def __init__(self, config: AppConfig) -> None:
6976 def run (self ) -> None :
7077 self ._listener .start ()
7178 self ._keyboard_listener .start ()
79+ if self ._recording_submit_listener is not None :
80+ self ._recording_submit_listener .start ()
7281 self ._set_recording_status (False )
82+ recording_submit_hotkey = self ._config .recording_submit_keycode
7383 _LOG .info (
7484 "VibeMouse ready. "
7585 + f"Model={ self ._config .model_name } , preferred_device={ self ._config .device } , "
7686 + f"backend={ self ._config .transcriber_backend } , auto_paste={ self ._config .auto_paste } , "
7787 + f"enter_mode={ self ._config .enter_mode } , debounce_ms={ self ._config .button_debounce_ms } , "
7888 + f"front_button={ self ._config .front_button } , rear_button={ self ._config .rear_button } , "
7989 + f"record_hotkey_keycodes={ self ._config .record_hotkey_keycodes } , "
90+ + f"recording_submit_keycode={ recording_submit_hotkey } , "
8091 + f"gestures_enabled={ self ._config .gestures_enabled } , "
8192 + f"gesture_trigger={ self ._config .gesture_trigger_button } , "
8293 + f"gesture_threshold_px={ self ._config .gesture_threshold_px } , "
@@ -97,6 +108,8 @@ def run(self) -> None:
97108 def shutdown (self ) -> None :
98109 self ._listener .stop ()
99110 self ._keyboard_listener .stop ()
111+ if self ._recording_submit_listener is not None :
112+ self ._recording_submit_listener .stop ()
100113 self ._recorder .cancel ()
101114 self ._set_recording_status (False )
102115 with self ._workers_lock :
@@ -159,6 +172,12 @@ def _on_rear_press(self) -> None:
159172 except Exception as error :
160173 _LOG .exception ("Failed to send Enter: %s" , error )
161174
175+ def _on_recording_submit_press (self ) -> None :
176+ if not self ._recorder .is_recording :
177+ return
178+ _LOG .info ("Recording submit hotkey pressed, routing to rear-button logic" )
179+ self ._on_rear_press ()
180+
162181 def _on_gesture (self , direction : str ) -> None :
163182 action = self ._resolve_gesture_action (direction )
164183 if action == "noop" :
0 commit comments