Ubuntu 键盘映射

Ubuntu 键盘映射

在 Ubuntu 16.04 中,如何发现哪个键盘按钮被分配给反斜杠?

我使用了 xmodmap 中的 -pke 选项来列出键盘布局。结果列出了 255 个键码。哪个键码对应于反斜杠?

答案1

您可以使用这个小工具xev

它是一个事件测试器,会打开一个小白窗口,用于检测鼠标和键盘事件。它会将输出打印到控制台。

例如反斜杠给出以下输出:

KeyPress event, serial 37, synthetic NO, window 0x2600001,
    root 0x4a9, subw 0x0, time 1190007, (62,493), root:(1747,545),
    state 0x10, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
    XKeysymToKeycode returns keycode: 92
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 37, synthetic NO, window 0x2600001,
    root 0x4a9, subw 0x0, time 1190519, (62,493), root:(1747,545),
    state 0x90, keycode 20 (keysym 0x5c, backslash), same_screen YES,
    XLookupString gives 1 bytes: (5c) "\"
    XmbLookupString gives 1 bytes: (5c) "\"
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x2600001,
    root 0x4a9, subw 0x0, time 1190671, (62,493), root:(1747,545),
    state 0x90, keycode 20 (keysym 0x5c, backslash), same_screen YES,
    XLookupString gives 1 bytes: (5c) "\"
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x2600001,
    root 0x4a9, subw 0x0, time 1190815, (62,493), root:(1747,545),
    state 0x90, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
    XKeysymToKeycode returns keycode: 92
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

第一个事件是我在键盘上必须按下的修饰键。第二个事件是反斜杠所在的实际键。然后是两个释放事件。

答案2

当我在我的 Ubuntu 14.04 中执行时,我发现它如下(密钥代码 51):

$ xmodmap -pke | grep -i slash
keycode  16 = 7 slash 7 ampersand braceleft seveneighths
keycode  20 = apostrophe question minus underscore backslash questiondown
keycode  28 = t T t T tslash Tslash
keycode  32 = o O o O oslash Oslash
keycode  49 = masculine ordfeminine grave asciitilde backslash backslash
keycode  51 = ccedilla Ccedilla backslash bar braceright dead_breve
keycode  61 = minus underscore slash question dead_belowdot dead_abovedot

相关内容