我想在启动时切换 i3 中的大写锁定,我编写了一个脚本并输入以下代码:
setxkbmap -option ctrl:nocaps
但我仍然收到消息:
Mär 28 09:52:20 dave-desktop systemd[1]: myfirst.service: Main process exited, code=exited, status=255/EXCEPTION
Mär 28 09:52:20 dave-desktop test.sh[6068]: Cannot open display "default display"
有人有什么解决办法吗?
答案1
这是我使用.XModmap找到的解决方案:
将其放入 ~/.Xmodmap 中,如果您遇到类似问题,请xev
检查您的键名。
!
! Swap Caps_Lock and Control_L
!
remove Lock = Caps_Lock
remove Control = Control_L
remove Lock = Control_L
remove Control = Caps_Lock
keysym Control_L = Caps_Lock
keysym Caps_Lock = Control_L
add Lock = Caps_Lock
add Control = Control_L
进一步阅读:
https://unix.stackexchange.com/questions/107566/how-to-swap-ctrl-and-capslock-using-xmodmap https://medium.com/@retprogramisto/how-to-make-custom-keyboard-map-with-xmodmap-1341a1552d4f