O programa xev
gerará os códigos de teclas esperados. Para o seu exemplo de 1 :
KeyPress event, serial 37, synthetic NO, window 0x600001,
root 0xd4, subw 0x0, time 6931965, (284,-10), root:(285,560),
state 0x0, keycode 10 (keysym 0x31, 1), same_screen YES,
XLookupString gives 1 bytes: (31) "1"
XmbLookupString gives 1 bytes: (31) "1"
XFilterEvent returns: False
KeyRelease event, serial 37, synthetic NO, window 0x600001,
root 0xd4, subw 0x0, time 6932164, (284,-10), root:(285,560),
state 0x0, keycode 10 (keysym 0x31, 1), same_screen YES,
XLookupString gives 1 bytes: (31) "1"
XFilterEvent returns: False