<div dir="ltr">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.</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On 29 April 2014 17:13, Niklas Hambüchen <span dir="ltr"><<a href="mailto:mail@nh2.me" target="_blank">mail@nh2.me</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Do you wish to do that in an active Xorg GUI session?<br>
<br>
If yes, the X API (and corresponding Haskell packages) will allow you<br>
to do that; otherwise you usually have to read directly from the device<br>
files (e.g. /dev/input*) which usually requires root.<br>
<div class="HOEnZb"><div class="h5"><br>
On Tue 29 Apr 2014 15:55:00 BST, EatsKittens wrote:<br>
> Essentially, I want to create a program that is simply ran in the<br>
> background, not in a terminal, that monitors keypresses and mouse<br>
> presses and takes certain actions on specific keypresses. Where to start?<br>
<br>
</div></div></blockquote></div><br></div>