Swap capslock with escape globally

hello I am completely new to linux,
can someone guide me to use setxkbmap to swap capslock with escape key so when I press esc it register capslock and when i press capslock pc register escape.

I found this solution but donโ€™t know how to even access ~/.xinitrc or .xsession and what they are
please guide me :pray:


~/.xinitrc and ~/.xsession are files located in your home directory and executed at the beginning of your session. You can add a line to the .xinitrc file with the following command in a terminal:
echo "setxkbmap -option caps:escape" >> ~/.xinitrc

You can also edit it with an editor such as nano, kate, etc.

thank you for your response,:grinning:
I ran the command and It is not getting executed while boot :thinking:
this is how the file looks

should the command be above exec $(get_session โ€œ$1โ€)

Go to System Settings โ†’ Input Devices โ†’ Keyboard โ†’ Advanced. There you will see options for Caps Lock behaviour.

oh thank you I will do that,
please help when I deleted that setxkbmap command and exit nano it shows these options which should I choose

Simply press Return

thank you that worked and is much simpler for a beginner :slight_smile:

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.