-1

I want to switch caps lock in i3 at startup I wrote a script and put this code:

setxkbmap -option ctrl:nocaps

But still i get the message:

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"

Anyone any solution?

muru
  • 197,895
  • 55
  • 485
  • 740
David
  • 224

1 Answers1

0

Here is a solution i found using .XModmap:

Put this in ~/.Xmodmap and if you have a similar problem use xev to check out your Keynames.

!
! 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

For further reading:

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

David
  • 224