5

我拥有一个Razer Naga 鼠标,基本上它的侧面有一个小数字键盘。我想将这些键重新映射到不同的未使用键或 bash 命令。我可以通过使用 xev 获取键码(例如鼠标上的“1”是键码 87)轻松做到这一点,然后我可以使用 xmodmap 将键码绑定到不同的键。

然而,我键盘上的小键盘也会继承这一点,因为键码是相同的,但我注意到“序列”是不同的。

例如,这是在我的鼠标小键盘上按下“1”按钮时 xev 的输出。

KeyPress event, serial 34, synthetic NO, window 0x1c00001,
root 0x1ae, subw 0x0, time 2179878, (170,-2), root:(198,345),
state 0x0, keycode 87 (keysym 0xff9c, KP_End), same_screen YES,
XLookupString gives 0 bytes: 
XmbLookupString gives 0 bytes: 
XFilterEvent returns: False

KeyRelease event, serial 35, synthetic NO, window 0x1c00001,
root 0x1ae, subw 0x0, time 2179966, (170,-2), root:(198,345),
state 0x0, keycode 87 (keysym 0xff9c, KP_End), same_screen YES,
XLookupString gives 0 bytes: 
XFilterEvent returns: False

这是在我的键盘小键盘上按“1”时的输出

KeyPress event, serial 35, synthetic NO, window 0x1c00001,
root 0x1ae, subw 0x0, time 2180261, (170,-2), root:(198,345),
state 0x0, keycode 87 (keysym 0xff9c, KP_End), same_screen YES,
XLookupString gives 0 bytes: 
XmbLookupString gives 0 bytes: 
XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x1c00001,
root 0x1ae, subw 0x0, time 2180341, (170,-2), root:(198,345),
state 0x0, keycode 87 (keysym 0xff9c, KP_End), same_screen YES,
XLookupString gives 0 bytes: 
XFilterEvent returns: False

无论如何我可以根据这个映射鼠标上的键吗?

4

2 回答 2

3

而不是xmodmap,尝试使用setxkbmapand xkbcomp。该xkbcomp命令允许您指定输入设备 ID(使用-i选项)。

要获取设备 ID 列表,请运行xinput --list. (FWIW,我的 Razer Salmosa 被清楚地标记为“Razer Razer Salmosa”。)

以下是我如何将我的 USB 键盘 (ID 16) 转换为使用德语键映射,同时将我的笔记本电脑键盘保持在美国映射上:

setxkbmap de -print | xkbcomp - -i 16 $DISPLAY

我真的不知道如何设置xkb映射,但我找到了一个看起来不错的教程

于 2011-10-02T00:30:31.883 回答
1

好的解决了。按照此 wiki 上的说明操作https://github.com/graph/Razer-Naga-HotKey/wiki/How-to-get-Razer-Naga-HotKeying-Working-on-Debian

于 2011-10-01T21:09:54.707 回答