Monday, 3 December 2012

What key am I pressing? oops!

As the proud owner of a blank key caps keyboard (and not just any keyboard!) there are times when I need to remap certain keys.

One of my Kinesis Advantage with blank key caps

Having moved recently to archlinux with i3 as my window manager I no longer have graphical keyboard settings tools installed.

xev to the rescue!

xev is a command line tool that prints the contents of events in the X Window System:

KeyPress event, serial 54, synthetic NO, window 0x1a00001,
    root 0x289, subw 0x0, time 2834169, (-425,551), root:(539,599),
    state 0x0, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 54, synthetic NO, window 0x1a00001,
    root 0x289, subw 0x0, time 2834272, (-425,551), root:(539,599),
    state 0x4, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 54, synthetic NO, window 0x1a00001,
    root 0x289, subw 0x0, time 2834682, (-425,551), root:(539,599),
    state 0x0, keycode 47 (keysym 0x3b, semicolon), same_screen YES,
    XLookupString gives 1 bytes: (3b) ";"
    XmbLookupString gives 1 bytes: (3b) ";"
    XFilterEvent returns: False

KeyRelease event, serial 54, synthetic NO, window 0x1a00001,
    root 0x289, subw 0x0, time 2834777, (-425,551), root:(539,599),
    state 0x0, keycode 47 (keysym 0x3b, semicolon), same_screen YES,
    XLookupString gives 1 bytes: (3b) ";"
    XFilterEvent returns: False

KeyPress event, serial 54, synthetic NO, window 0x1a00001,
    root 0x289, subw 0x0, time 2838923, (-425,551), root:(539,599),
    state 0x0, keycode 62 (keysym 0xffe2, Shift_R), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 54, synthetic NO, window 0x1a00001,
    root 0x289, subw 0x0, time 2838994, (-425,551), root:(539,599),
    state 0x1, keycode 62 (keysym 0xffe2, Shift_R), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

MotionNotify event, serial 32, synthetic NO, window 0x1e00001,
    root 0x289, subw 0x0, time 8794435, (20,392), root:(1304,440),
    state 0x0, is_hint 0, same_screen YES

MotionNotify event, serial 32, synthetic NO, window 0x1e00001,
    root 0x289, subw 0x0, time 8794447, (1,393), root:(1285,441),
    state 0x0, is_hint 0, same_screen YES

LeaveNotify event, serial 32, synthetic NO, window 0x1e00001,
    root 0x289, subw 0x0, time 8794458, (-16,393), root:(1268,441),
    mode NotifyNormal, detail NotifyNonlinear, same_screen YES,
    focus YES, state 0

KeyPress event, serial 32, synthetic NO, window 0x1e00001,
    root 0x289, subw 0x0, time 8795156, (-83,393), root:(1201,441),
    state 0x0, keycode 42 (keysym 0x67, g), same_screen YES,
    XLookupString gives 1 bytes: (67) "g"
    XmbLookupString gives 1 bytes: (67) "g"
    XFilterEvent returns: False

KeyRelease event, serial 32, synthetic NO, window 0x1e00001,
    root 0x289, subw 0x0, time 8795235, (-83,393), root:(1201,441),
    state 0x0, keycode 42 (keysym 0x67, g), same_screen YES,
    XLookupString gives 1 bytes: (67) "g"
    XFilterEvent returns: False

The interesting lines are the ones with the keycode and symbol:

...
state 0x0, keycode 62 (keysym 0xffe2, Shift_R), same_screen YES,
...

No more blind key remaps :)

No comments:

Post a Comment