我们需要用到一个程序:https://gitlab.com/interception/linux/plugins/caps2esc
它的作用
- Put what's useless in its place By moving the CAPSLOCK function to the far ESC location
- Make what's useful comfortably present, just below your Pinky By moving both ESC and CTRL functions to the CAPSLOCK location
说人话就是 Esc 变成了Caps。Caps 在单击时为Esc,长按做组合键是为 Ctrl
1. 大佬直接提供了AUR包,arch/Manjaro直接使用下列代码安装
<code> yay -S interception-tools
yay -S interception-caps2esc/<code>
使用其他Linux发行版请自行编译,相信既然都在用Linux了,cmake肯定会用吧
其他Linux发行版使用方法askubuntu.comaskubuntu.com
2. 安装好了以后,在/etc/udevmon.yaml添加下列代码
<code>- JOB: "intercept -g $DEVNODE | caps2esc | uinput -d $DEVNODE"
DEVICE:
EVENTS:
EV_KEY: [KEY_CAPSLOCK, KEY_ESC]/<code>
3. 在/etc/systemd/system/udevmon.service中添加下列代码
<code>[Unit]
Description=udevmon
Wants=systemd-udev-settle.service
After=systemd-udev-settle.service
[Service]
ExecStart=/usr/bin/nice -n -20 /usr/bin/udevmon -c /etc/udevmon.yaml
[Install]
WantedBy=multi-user.target/<code>
4. 最后使用sudo systemctl enable --now udevmon来启动
ok了,希望这篇文章能对大家有所帮助
閱讀更多 ourongxing 的文章