I'm going to make a presentation about a software product and it has some key shortcuts, that I want to show. Is there a program, which displays the keyboard-shortcuts, that I have used?


There is a program called key-mon that monitors the pressed keys. It's been some time since I used it, but it worked well and it's display is quite appealing.


You can use xev (X events) to do this.

Start the application you'd like to monitor, e.g., xman &.

Then, use wmctrl -l to list X windows. It could look like this:

0x00400009  0 VLAN-.... urxvt
0x00e0007a  0 VLAN-.... Iceweasel
0x00800011  0 VLAN-.... xman

You need the window (hex) ID in the first column; to get it, you could use grep and fetch the line by the fourth column (the application name, which is much more natural for you to use as a human) - when you have the line, you could get the first column with cut (the first field with -f1, using a whitespace delimiter -d" " to separate fields).

You could parse the data (to get the ID) in a number of ways, or even enter the ID manually, of course. (The zeroes in the second column above are the desktop number.)

Then, try

xev -id `wmctrl -l | grep xman | cut -d" " -f1` | tee event.txt

It will show the keystrokes (and more) in the same terminal as the command was invoked; plus, with tee, it'll store what you see in a file. It could be a good idea to let the output be shown on stdout in the terminal as this will show you instantly the action; also, if you don't run the command as a background process (with &), you can terminate it easily with Ctrl-C.

NOTE It works for urxvt and xman, but for some reason, it fails for Iceweasel in the above listing (it records something, but it isn't presenting key events as clear (by far) as is the case with those other examples.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.