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
7
u/Interesting_Debate57 Jun 03 '26
Eh, I'm pretty sure the kernel device drivers will handle it all directly.
If OP is not writing kernel code, then maybe it's time to learn about STDIN.