将组合键重新映射到另一个组合键,例如 Super+Ctrl+Shift+J -> Ctrl+Shift+Left

将组合键重新映射到另一个组合键,例如 Super+Ctrl+Shift+J -> Ctrl+Shift+Left

我想实现一个附加键层,这样我无需移动手腕就可以访问非字母数字键。

我一直在为此目的使用 Autokey,但体验并不令人满意:它偶尔会出现滞后,并且会让原始的击键溜进某些应用程序中。

所以我需要一个低级的解决方案。

答案1

给出组合绑定键韋克尝试一下。xbindkeys监听按键并将翻译发送给 xvkbd。

sudo apt-get install xbindkeys xvkbd
xbindkeys --defaults > ~/.xbindkeysrc

在您最喜欢的编辑器中打开.xbindkeysrc。我注释掉了其他所有内容,但如果需要的话,可以参考一下。

为了检查这一点,我尝试将Ctrl+映射;Ctrl+ V

"xvkbd -xsendevent -text "\Cv""
   control + semicolon

我猜你会想得到这样的结果:

"xvkbd -xsendevent -text "\C\S\[Left]""
  Super+Control+Shift+J

保存文件,然后运行xbindkeys

为了重新加载任何配置更改,我终止了该xbindkeys进程然后重新启动。

xbindkeys 语法

我使用 GUI 计算出了组合键xbindkeys

sudo apt-get install xbindkeys-config
xbindkeys-config

运行该程序后,按“获取密钥”将组合放入.xbindkeysrc文件的第二行。

xvkbd 语法

来自手册:

\r - Return
\t - Tab
\b - Backspace
\e - Escape
\d - Delete
\S - Shift (modify the next character; please note that modify with ``\S'' will be ignored in many cases. For example, ``a\Cb\ScD\CE'' will be interpreted as a, Control-b, c, Shift-D, and Control-Shift-E.)
\C - Control (modify the next character)
\A - Alt (modify the next character)
\M - Meta (modify the next character)
\[keysym] - the keysym keysym (e.g., \[Left]), which will be processed in the similar matter with other general characters
\{keysym} - the keysym keysym (e.g., \{Left}), which will be processed in more primitive matter and can also be used for modofier keys such as Control_L, Meta_L, etc.; also, \{+keysym} and \{+keysym} will simulate press and release of the key, respectively [Version 3.3]
\Ddigit - delay digit * 100 ms
\xvalue - move mouse pointer (use "+" or "-" for relative motion)
\yvalue - move mouse pointer (use "+" or "-" for relative motion)
\mdigit - simulate click of the specified mouse button

很想听听它的效果如何,以及这个组合是否适合您的目的。它看起来是一个不错的键盘映射器,但不一定是一个宏运行器。

答案2

我认为您可以在这里找到解决方案(因为 Xorg 是最底层...):https://wiki.archlinux.org/index.php/Keyboard_configuration_in_Xorg

lv3:win_switch编辑:据我了解,您需要在 .conf 文件中添加选项

答案3

您可以使用重新映射守护进程密钥请参阅这个答案了解安装、使用和提示。

您可以将其用于标题示例的确切行为,但为了简单起见,我下面仅用于space在按住时按下其他东西时激活移动层space,否则会插入一个空格。

安装后,使用以下配置:

[ids]

*

[main]

# set the behavior of space (you could also use a timeout):
space = overload(spacemove,space)

# this defines the space layer, the function of keys when space is held
# all non-described keys act as in the layer [main]
[spacemove]
i = up
k = down 
j = left
l = right

keyd 非常通用、稳定且快速。

相关内容