I want to write to a file when a modifier key is released on linux so I can run a custom handler in Emacs.

I've found that xbindkeys can run commands key release events when regular keys are pressed and when a modifier and a regular key is pressed. However it does nothing when a modifier alone is released.

I want something that I can run as a command line tool in the background.

The closest I have found is the python keyboard package but it needs root.

I did some more searching and found https://pypi.org/project/pynput/. It's like python keyboard but does not require root. I can use that to build a command line app but I wish there was one that existed already.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.