将非修饰符配置为修饰键

将非修饰符配置为修饰键

这个问题类似于:

https://askubuntu.com/questions/33751/making-any-key-into-a-modifier-key

我有一台具有非标准键盘布局的机器(lenovo 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 修饰键?或者是否有一些硬件限制阻止了这种情况?

答案1

除了你的两个命令之外,你还必须添加控制:
xmodmap -e 'keycode 110 = Control_L' # Home
xmodmap -e 'keycode 115 = Control_L' # End
xmodmap -e 'add Control = Control_L'

相关内容