-
Notifications
You must be signed in to change notification settings - Fork 579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eventtap: Possible to know the keyboard that produced the event? #1083
Comments
With what we have now, no, I don't believe it is possible... and an initial search on the Internet suggests much the same... by the time the Quartz Event Services hands things off to an application, there doesn't seem to be a way to get a vendor ID for a key event... for a tablet, yes, but not for a key. If the YubiKey isn't something that you have plugged in regularly, you could set up a usb watcher with If anyone has any other thoughts, I'd like to be proven wrong... I have a couple of USB keyboards I don't like the layout of and wouldn't mind being able to change on the fly myself, but in a selective way. |
(I'm going to close this out because I don't think there is any work to be done in Hammerspoon. Please re-open if you disagree!) |
@wincent, no idea if this might help, but you might check the |
Yeah, I already checked that one out @asmagill. In the end, I ended up working around the issue by getting a newer YubiKey that allows you to reprogram the scanmap, which I did (for Colemak) with:
|
Now that we're a few years later, anyone have other ideas about how to best detect which device a My usecase is thankfully simpler in that I can enable/disable the event listener via usb watchers. However, I figured I'd check this method first to see if I can escape-early if the event came from the wrong mouse and always have the listener active instead. |
Any solution for this in 2023. I have one trackball that I want to use exclusively for scrolling. I have implemented this using |
I don't think any of Apple's APIs for this have changed, unfortunately. I would suggest doing it with Karabiner, since it has access to the lower level device info. |
I have tried to make it with karabiner, # but its mouse_motion_to_scroll is too rigid. For Eg, I can't make acceleration custom, or I can't make it to scroll down using horizontal instead of vertical mouse movement. Is there any other tool I can use to achieve this? I have tried steermouse and usb overdrive, but it didn't work. Is there any way to, for example, decorate mouse inputs with additional info via some other software or some c++ scripts so hammerspoon can distinguish between devices. |
Use case: three "keyboards", one of which is actually a YubiKey (the others are the laptop built-in keyboard and a standard USB external keyboard).
The YubiKey has some oddities, including sending the wrong keycodes when the system layout is set to Colemak. I'd like to be able to remap (fix) those keys using
hs.eventtap
, but specifically for the YubiKey, leaving the others alone.Alas, there doesn't seem to be anything in
hs.eventtap.event.properties
that I can use to distinguish the keyboards. For example,keyboardEventKeyboardType
returns 43 for the laptop, but 40 for both the USB keybord and the YubiKey. I've looked through the raw event data and can't find anything there either.Is it possible to obtain event source information, and can it be exposed to Hammerspoon?
The text was updated successfully, but these errors were encountered: