这个问题类似于:
https://askubuntu.com/questions/33751/making-any-key-into-a-modifier-key
我有一台具有非标准键盘布局(联想 x1 carbon)的机器,其中 CapsLock 键已被 Home、End 取代。我习惯将 CapsLock 映射为控件,所以我使用 xmodmap 来映射 Home,End 到 Control:
xmodmap -e 'keycode 110 = Control_L' # Home
xmodmap -e 'keycode 115 = Control_L' # End
当我单独按 Home(或 End)时,会检测到正确的键符:
state 0x0, keycode 110 (keysym 0xffe3, Control_L), same_screen YES,
但我不能使用重新映射的 Home 或 End 键作为任何其他键的修饰符:当我按 Control+a 时,a 键不会被修改:
KeyPress event, serial 36, synthetic NO, window 0x1000001,
root 0xe0, subw 0x0, time 15157752, (829,406), root:(830,407),
state 0x0, keycode 110 (keysym 0xffe3, Control_L), same_screen YES,
XKeysymToKeycode returns keycode: 37
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 36, synthetic NO, window 0x1000001,
root 0xe0, subw 0x0, time 15157761, (829,406), root:(830,407),
state 0x0, keycode 38 (keysym 0x61, a), same_screen YES,
XLookupString gives 1 bytes: (61) "a"
XmbLookupString gives 1 bytes: (61) "a"
XFilterEvent returns: False
KeyRelease event, serial 36, synthetic NO, window 0x1000001,
root 0xe0, subw 0x0, time 15157912, (829,406), root:(830,407),
state 0x0, keycode 38 (keysym 0x61, a), same_screen YES,
XLookupString gives 1 bytes: (61) "a"
XFilterEvent returns: False
KeyRelease event, serial 36, synthetic NO, window 0x1000001,
root 0xe0, subw 0x0, time 15157949, (829,406), root:(830,407),
state 0x0, keycode 110 (keysym 0xffe3, Control_L), same_screen YES,
XKeysymToKeycode returns keycode: 37
XLookupString gives 0 bytes:
XFilterEvent returns: False
而如果我使用“真实”控制键,则“a”键按下具有控制修饰符状态:
KeyPress event, serial 36, synthetic NO, window 0x1000001,
root 0xe0, subw 0x0, time 15160488, (829,406), root:(830,407),
state 0x0, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 36, synthetic NO, window 0x1000001,
root 0xe0, subw 0x0, time 15161477, (829,406), root:(830,407),
state 0x4, keycode 38 (keysym 0x61, a), same_screen YES,
XLookupString gives 1 bytes: (01) ""
XmbLookupString gives 1 bytes: (01) ""
XFilterEvent returns: False
KeyRelease event, serial 36, synthetic NO, window 0x1000001,
root 0xe0, subw 0x0, time 15161588, (829,406), root:(830,407),
state 0x4, keycode 38 (keysym 0x61, a), same_screen YES,
XLookupString gives 1 bytes: (01) ""
XFilterEvent returns: False
KeyRelease event, serial 36, synthetic NO, window 0x1000001,
root 0xe0, subw 0x0, time 15161842, (829,406), root:(830,407),
state 0x4, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
在我的情况下,是否可以将 Home 键配置为 Control 修饰键?还是有一些硬件限制阻止了这一点?
除了您的两个命令之外,您还必须添加 Control:
xmodmap -e 'keycode 110 = Control_L' # Home
xmodmap -e 'keycode 115 = Control_L' # End
xmodmap -e 'add Control = Control_L'