我有一个键盘,在空格键旁边有一个神秘的 LNG 键,AltGr 通常位于该位置。有没有办法让AltGr(Alt)出来?
这是 LNG 键被按下并释放一次的 xev
控制台输出:
KeyPress event, serial 40, synthetic NO, window 0x5400001,
root 0xf5, subw 0x0, time 56044552, (-281,525), root:(827,552),
state 0x0, keycode 105 (keysym 0xffe4, Control_R), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 40, synthetic NO, window 0x5400001,
root 0xf5, subw 0x0, time 56044568, (-281,525), root:(827,552),
state 0x4, keycode 62 (keysym 0xffe2, Shift_R), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 40, synthetic NO, window 0x5400001,
root 0xf5, subw 0x0, time 56044587, (-281,525), root:(827,552),
state 0x5, keycode 105 (keysym 0xffe4, Control_R), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 40, synthetic NO, window 0x5400001,
root 0xf5, subw 0x0, time 56044587, (-281,525), root:(827,552),
state 0x1, keycode 62 (keysym 0xffe2, Shift_R), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
有没有办法利用这些信息?
更新:
不幸的是,这是不可能的,因为 LNG key 会同时触发两个 key 代码。
将菜单
重新映射到Alt R
:
更改为/usr/share/X11/xkb/symbols/pc:
key <MENU> { [ Menu ] };
至
key <MENU> { [ Alt_R ] };
从/var/lib/xkb/中删除预编译的 *.xkm 文件(如果有)
最佳答案
您可能希望使用 xbindkeys。安装它,然后运行 xbindkeys --key 来查看运行了哪些键。然后创建 .xbindkeysrc 文件来绑定(bind)该 key 。据我所知,它会触发一个命令,因此您可以使用 xdotool 模拟该命令。
这是一个类似的页面,其中包含 xbindkeys 教程: https://askubuntu.com/a/561464/896870
Xbindkeys 和 xdotool 应该位于公共(public)存储库上。
编辑:我还应该注意 xbindkeys 守护进程必须在启动时运行。设置一个启动命令来简单地运行xbindkeys
,它将开始运行。这个 cna 可以在 XFCE 机器的 session 和启动中设置,但您也可以在 init.d 中设置它。
关于Linux,键盘: remap LNG to AltGr,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53609054/