Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 5 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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