Linux,键盘: remap LNG to AltGr

标签 linux keyboard key mapping

我有一个键盘,在空格键旁边有一个神秘的 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/

相关文章:

linux - 用于在 Linux 中进行远程文件访问的库?

linux - Sonarqube 6.7 从 JVM 获得 ping 响应并突然在 AWS 上停止

c - 数组上不兼容指针类型警告的分配

c++ - 单个文件上两个 C FILE* 流的一致性

keyboard - 调用 RubyMine 控制台中的上一个命令

php - 将新的命名键添加到 preg_match_all 的匹配项中

javascript - 在 CouchDB 中使用数组键进行过滤

ios - 在移动 Safari 上关闭软件键盘后,带有选项的 <select> 标签位置错误

assembly - 实模式汇编获取键盘输入

list - Flutter:通用列表处理不同的键值对