cheat.sheets:xev
# xev
# Print contents of X events
# Start xev(1) and show only the relevant parts.
xev | awk -F'[ )]+' '
/^KeyPress/ {
a[NR+2]
}
NR in a {
printf "%-3s %s\n", $5, $8
}
'
# Alternative approach to showing keycodes.
#
# Note that the use of `<(xev)` is process substitution, which is unavailable
# in the Bourne Shell and its standard derivatives, nor is it available in Bash
# with its own POSIX mode enabled.
awk '
/^KeyPress/ {
A[NR+2]
}
NR in A {
B=substr($7, 0, length($7) - 2)
printf("%3d %s\n", $4, B)
}
' <(xev)
tldr:xev
# xev
# Print contents of X events.
# More information: <https://gitlab.freedesktop.org/xorg/app/xev>.
# Monitor all occurring X events:
xev
# Monitor all X events of the root window instead of creating a new one:
xev -root
# Monitor all X events of a particular window:
xev -id window_id
# Monitor X events from a given category (can be specified multiple times):
xev -event event_category
$
cheat.sh