blob: 643261e3e637ccd64c468175e96da755d3ea6287 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# xkbcat
X11 keylogger with a simple output format: One key event per line on `stdout`.

<br /><sup>[Chi] definitely gets it.</sup>
Great as a data source for keyboard heatmaps, layout comparisons or
screencasting applications.
< 100 lines of modern C. Doesn't need `sudo`.
## Examples
Given no flags, `xkbcat` prints only keypresses, one per line. Here's the
output when I type "Hi":
Shift_L
h
i
With key-ups enabled (`xkbcat -up`), the format changes to show them:
+ Shift_L
+ h
- h
- Shift_L
+ i
- i
Lines starting `+` are key-downs; `-` are key-ups.
Left- and right-positioned modifier keys are recognised separately. The F-keys
work too, as do most media keys like `XF86AudioLowerVolume`.
## Compilation
Just `make`.
Don't have `clang`? Edit the `makefile` to use `gcc`.
## Usage
Flags you can pass (all optional):
- `-display <display>`: set target X display (default `:0`)
- `-delay <nanosec>`: delay between polls to the keyboard (default `10000000`;
that's 100ms)
- `-up`: also prepend key-ups (default: don't)
- `-time`: also append epoch timestamps (default: don't)
- `-help`: print usage hints and exit
Then just type as you would usually. Interrupt signal (`C-c`) to end.
## Related programs
If you like spying on people (ethically, of course), [`xspy`][1] or
[`logkeys`][2] might be better for you. They use the modifier keys to infer
what was actually typed, so it's easier to read what's happening.
## License
[ISC][3].
[1]: http://www.freshports.org/security/xspy/
[2]: http://code.google.com/p/logkeys/
[3]: http://opensource.org/licenses/ISC
[Chi]: http://en.wikipedia.org/wiki/Chi's_Sweet_Home
|