pyinput give the possibility to add mouse hotkey, like the side buttons. It is much convenient to use it with a thumb click. Could you elaborate it to add mouse hotkey functionality as well with pynput? It can be used next to the keyboard hotkeys.
I have done it personally to test it and works great.
Like:
from pynput import mouse
def run(self):
"""Run the recorder, setting up hotkeys and entering the main loop."""
keyboard.add_hotkey(config.RECORD_HOTKEY, self.handle_hotkey_wrapper)
keyboard.add_hotkey(config.CANCEL_HOTKEY, self.cancel_all)
keyboard.add_hotkey(config.CLEAR_HISTORY_HOTKEY, self.clear_messages)
def on_click(x, y, button, pressed):
if button == getattr(mouse.Button, config.MOUSE_CANCEL_HOTKEY) and pressed:
self.cancel_all()
elif button == getattr(mouse.Button, config.MOUSE_RECORD_HOTKEY) and pressed:
self.handle_hotkey_wrapper()
elif button == getattr(mouse.Button, config.MOUSE_CLEAR_HISTORY_HOTKEY) and pressed:
self.clear_messages()
mouse_listener = mouse.Listener(on_click=on_click)
mouse_listener.start()
print(f"Press '{config.RECORD_HOTKEY}' to start recording, press again to stop and transcribe.\nDouble tap to give the AI access to read your clipboard.\nPress '{config.CANCEL_HOTKEY}' to cancel recording.\nPress '{config.CLEAR_HISTORY_HOTKEY}' to clear the chat history.")
Or replace the keyboard as well with pynput as in a pull request suggested.
Oh awesome having it hooked up to a mouse button would be awesome! I'm looking at swapping away from the current keyboard library, at very least I will add support for pynput.
Thanks for submitting the issue!
pyinput give the possibility to add mouse hotkey, like the side buttons. It is much convenient to use it with a thumb click. Could you elaborate it to add mouse hotkey functionality as well with pynput? It can be used next to the keyboard hotkeys. I have done it personally to test it and works great. Like:
Or replace the keyboard as well with pynput as in a pull request suggested.
Config.py: