xev 表示 Caps Lock 重新映射已起作用,但其他应用程序看不到它

xev 表示 Caps Lock 重新映射已起作用,但其他应用程序看不到它

我正在尝试将 Caps Lock 重新映射到 Control。在我修改任何内容之前,xev按下/释放 Caps Lock 时会报告以下内容:

KeyPress event, serial 73, synthetic NO, window 0x2600001,
    root 0x290, subw 0x0, time 50243576, (82,130), root:(1365,612),
    state 0x0, keycode 66 (keysym 0xffe5, Caps_Lock), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

PropertyNotify event, serial 73, synthetic NO, window 0x2600001,
    atom 0x17c (XKLAVIER_STATE), time 50243577, state PropertyNewValue

PropertyNotify event, serial 73, synthetic NO, window 0x2600001,
    atom 0x17c (XKLAVIER_STATE), time 50243579, state PropertyNewValue

KeyRelease event, serial 73, synthetic NO, window 0x2600001,
    root 0x290, subw 0x0, time 50243680, (82,130), root:(1365,612),
    state 0x2, keycode 66 (keysym 0xffe5, Caps_Lock), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

我运行以下命令来重新映射:

xmodmap -e 'remove Lock = Caps_Lock'
xmodmap -e 'keysym Caps_Lock = Control_L'
xmodmap -e 'add Lock = Caps_Lock'
xmodmap -e 'clear Lock'
xmodmap -e 'keycode 66 = Control_L'

现在,关于 Caps Lock 的新闻/发布会xev报道:

KeyPress event, serial 80, synthetic NO, window 0x2600001,
    root 0x290, subw 0x0, time 50785441, (11,140), root:(1294,622),
    state 0x0, keycode 66 (keysym 0xffe3, Control_L), same_screen YES,
    XKeysymToKeycode returns keycode: 37
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 80, synthetic NO, window 0x2600001,
    root 0x290, subw 0x0, time 50785521, (11,140), root:(1294,622),
    state 0x0, keycode 66 (keysym 0xffe3, Control_L), same_screen YES,
    XKeysymToKeycode returns keycode: 37
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

这似乎没问题,但该键在所有其他应用程序中仍可用作 Caps Lock。我确实注意到,当我按下“真正的”左控制键时,没有XKeysymToKeycode,但我不知道这是什么意思。

以下是真正按下/释放左 Ctrl 键的事件:

KeyPress event, serial 37, synthetic NO, window 0x2600001,
    root 0x290, subw 0x0, time 57111640, (176,176), root:(188,272),
    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 37, synthetic NO, window 0x2600001,
    root 0x290, subw 0x0, time 57111736, (176,176), root:(188,272),
    state 0x4, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

相关内容