New keyboard shortcuts
This commit is contained in:
@@ -346,20 +346,22 @@ def cleanup_and_exit(state: State):
|
||||
|
||||
def _bind_hotkeys(state: State):
|
||||
logging.debug(
|
||||
"Binding hotkeys: capture=%s send=%s action3=%s reset=%s quit=%s toggle_mode=%s",
|
||||
"Binding hotkeys: capture=%s send=%s action3=%s reset=%s quit=%s toggle_mode=%s suppress=%s",
|
||||
state.cfg.shortcut_capture,
|
||||
state.cfg.shortcut_send,
|
||||
state.cfg.shortcut_action3,
|
||||
state.cfg.shortcut_reset,
|
||||
state.cfg.shortcut_quit,
|
||||
state.cfg.shortcut_toggle_mode,
|
||||
getattr(state.cfg, 'suppress_hotkeys', True),
|
||||
)
|
||||
keyboard.add_hotkey(state.cfg.shortcut_capture, lambda: capture_active_window(state))
|
||||
keyboard.add_hotkey(state.cfg.shortcut_send, lambda: threading.Thread(target=send_to_openai, args=(state,), daemon=True).start())
|
||||
keyboard.add_hotkey(state.cfg.shortcut_action3, lambda: threading.Thread(target=handle_action3, args=(state,), daemon=True).start())
|
||||
keyboard.add_hotkey(state.cfg.shortcut_reset, lambda: reset_state(state))
|
||||
keyboard.add_hotkey(state.cfg.shortcut_quit, lambda: maybe_quit(state))
|
||||
keyboard.add_hotkey(state.cfg.shortcut_toggle_mode, lambda: toggle_mode(state))
|
||||
suppress = getattr(state.cfg, 'suppress_hotkeys', True)
|
||||
keyboard.add_hotkey(state.cfg.shortcut_capture, lambda: capture_active_window(state), suppress=suppress)
|
||||
keyboard.add_hotkey(state.cfg.shortcut_send, lambda: threading.Thread(target=send_to_openai, args=(state,), daemon=True).start(), suppress=suppress)
|
||||
keyboard.add_hotkey(state.cfg.shortcut_action3, lambda: threading.Thread(target=handle_action3, args=(state,), daemon=True).start(), suppress=suppress)
|
||||
keyboard.add_hotkey(state.cfg.shortcut_reset, lambda: reset_state(state), suppress=suppress)
|
||||
keyboard.add_hotkey(state.cfg.shortcut_quit, lambda: maybe_quit(state), suppress=suppress)
|
||||
keyboard.add_hotkey(state.cfg.shortcut_toggle_mode, lambda: toggle_mode(state), suppress=suppress)
|
||||
# Ctrl+V listener (do not suppress paste)
|
||||
keyboard.add_hotkey("ctrl+v", lambda: on_paste_event(state), suppress=False)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user