r/C_Programming • u/Stickhtot • Jun 03 '26
Question Get ALL keyboard input from Linux?
I'm currently making a program where when a key is pressed on any window or screen, a specific action happens, right now I am reading from /dev/input/event with open() but the problem is
- It only reads from a very specific device
- It doesn't read from all "keyboards" that I have (I have a laptop keyboard and a wired keyboard) and
- Sometimes the main keyboard that I use will just switch up it's number and I have to recompile the thing again
Is there a way to just conveniently get all keyboard input without all this hassle?
10
Upvotes
View all comments
Show parent comment
2
u/Interesting_Debate57 Jun 03 '26
Right. I have a feeling that the abstraction layer between his physical devices and how they're referenced in the OS isn't helping much. Like, to get a physical device renamed you generally have to unplug it, plug something else in, then plug in the original device again.
But I agree, C isn't the issue here; understanding the interface to the OS is the issue.