talonvoice / talon

Issue Tracker for the main Talon app
85 stars 0 forks source link

Catch mouse clicks #155

Open mqnc opened 4 years ago

mqnc commented 4 years ago

I have built a board with six foot pedals which I want to use with talon. It simulates to be a hid mouse with six buttons. It reports left click, middle click, right click like a normal mouse and uses bits 3-5 of the button status byte (https://wiki.osdev.org/USB_Human_Interface_Devices#Report_format_2) for the other buttons.

I can read them like this: ''' from pynput import mouse

def on_click(x, y, button, pressed): print(button)

listener = mouse.Listener(on_click=on_click) listener.start() '''

and they are reported as Button.left, Button.middle, Button.right, Button.button8, Button.button9 and Button.button10.

Until talon supports this natively, I will just use pynput which works fine, so no pressure :)

mqnc commented 4 years ago

I had the problem that the buttons for bits 3 and 4 make the browser go back and forth, so I could not use them. Bits 5 to 7 did not have functions assigned yet but they still caused the window under the mouse to come to the foreground so I could also not use them and had to abandon this approach altogether. My foot pedal board now identifies as a gamepad and I used the inputs package to read it and then simulate mouse clicks. It might still be useful for some people to catch mouse clicks but for me personally this issue is no longer relevant.