This person has a similar project but for linux: https://unix.stackexchange.com/questions/343305/disable-keyboard-but-still-allow-reading-from-it
What I'm trying to do is make a numpad act like a launchpad. My goal is to consume the keystrokes coming from it, blocking them from going to the currently focused software.
I tried keyboard
and pynput
but neither could block the key events from being read by the currently focused application. I also looked into a nodejs approach to no avail.
I have no desire to use this numpad as a regular keyboard, so it would be okay if it were incapable of it as long as I can still respond to inputs in some background software.
When I asked ChatGPT, it said this might not be the kind of project that's doable on MacOS, which seems believable. I've never seen a piece of software that consumes key events while not in focus.
Is it possible? If so, how can I read input from a numpad while blocking its keystrokes in mac os?
Nodejs or Python would be preferable, but if I have to go through a compiled language and XCode, it is what it is.
Since I don't use mac os, I searched up the keyboard layout. Usually, there is a key on the keyboard labeled 'clear' or 'numlock', which effectively locks the numpad. To read keys from the numpad and distinguish between the other numerical keys, I did a little bit of digging, and found the perfect post about using pynput to do so.
Here's my snippet of code:
and this might work. I was a little confused when reading your question, so I apologize if I misinterpreted it.