I am writing a shell script that uses xinput
, and I would like to get a human-readable description of what the user has typed using the keycode from xinput
.
For example, A generates 38. Ctrl is 37.
How can I get those key names from the codes?
If your on Xorg use xev
: It opens a window that catches all events (incl. keystrokes) and displays the results, e.g.:
enter code KeyPress event, serial 40, synthetic NO, window 0x5400001,
root 0xc2, subw 0x5400002, time 29136757, (50,54), root:(1311,78),
state 0x1, keycode 38 (keysym 0x41, A), same_screen YES,
XLookupString gives 1 bytes: (41) "A"
XmbLookupString gives 1 bytes: (41) "A"
XFilterEvent returns: False
Maybe have a look at https://wiki.archlinux.org/index.php/extra_keyboard_keys for more details.
man -k keycode
?Couldn't get a file descriptor referring to the console
.