I need a program, say a Python script, to be notified when the CapsLock and NumLock status are changed.
I may have several keyboards and the code must run in user space so I can't rely on a kind of keylogger to receive KEY_CAPSLOCK events.
Some tools fire visual notifications by running
xset q in a loop, but I can't find anything useful for receiving direct events. I don't want to use the
xset method because I don't want to use a loop, I don't want to use an external tool and also that would need an X server.