【问题标题】:Linux, keyboard: remap LNG to AltGrLinux,键盘:将 LNG 重新映射到 AltGr
【发布时间】:2019-05-05 15:36:23
【问题描述】:

我在空格键旁边有一个带有神秘 LNG 键的键盘,AltGr 通常位于该位置。有没有办法让AltGr(Alt)脱离出来?

这是xev LNG 键被按下和释放一次的控制台输出:

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 钥匙会同时触发两个钥匙代码。

Menu 重新映射为Alt R

更改为 /usr/share/X11/xkb/symbols/pc:

key <MENU> {    [ Menu          ]   };

key <MENU> {    [ Alt_R         ]   };

从 /var/lib/xkb/ 中删除预编译的 *.xkm 文件(如果有)

【问题讨论】:

    标签: linux keyboard key mapping


    【解决方案1】:

    您可能希望使用 xbindkeys。安装它,然后运行xbindkeys --key 以查看运行了哪些密钥。然后让您的 .xbindkeysrc 文件绑定该密钥。据我所知,它会触发一个命令,因此您可以使用 xdotool 模拟该命令。

    这是一个带有 xbindkeys 教程的类似页面:https://askubuntu.com/a/561464/896870

    Xbindkeys 和 xdotool 应该在公共存储库中。

    编辑:我还应该注意 xbindkeys 守护程序必须在启动时运行。设置一个启动命令来简单地运行xbindkeys,它就会开始运行。这可以在 XFCE 机器的 Session and Startup 中设置,但您也可以在 init.d 中设置它。

    【讨论】:

    • 我想重新映射一个(修饰符?)键。您的意思是将其绑定到特定命令吗?这看起来不像我想要的。
    • 修改键可以使用 xbindkeys 来改变。使用 xbindkeys --key(或 -k)将密钥与其密钥代码相关联,然后将打开一个窗口;按下 LNG 键,它将为您提供代码。然后将其添加到您的 .xbindkeysrc 文件中。例如,语法是“xfce4-terminal”m:0x10 + c:156,此代码在此启动终端。如果您打算将密钥映射到另一个密钥,这可能无济于事,但您可以将其用于其他任何事情。 Xdotool 也适用于宏。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-18
    • 2015-07-11
    • 2011-10-26
    • 2012-08-19
    • 2012-11-28
    • 1970-01-01
    相关资源
    最近更新 更多