Yes, from within the X server. I've used Xlib in the past but this seemed mostly limited to window management and keypresses when a specific terminal in which a program is running has focus. I never came across a way to simply monitor arbitray keypresses from a background program and take action depending on them. For instance running a system command whenever ctrl+alt+r is pressed.


On 29 April 2014 17:13, Niklas Hambüchen <mail@nh2.me> wrote:
Do you wish to do that in an active Xorg GUI session?

If yes, the X API (and corresponding Haskell packages) will allow you
to do that; otherwise you usually have to read directly from the device
files (e.g. /dev/input*) which usually requires root.

On Tue 29 Apr 2014 15:55:00 BST, EatsKittens wrote:
> Essentially, I want to create a program that is simply ran in the
> background, not in a terminal, that monitors keypresses and mouse
> presses and takes certain actions on specific keypresses. Where to start?