Recently, I tried to switch capslock and ctrl on my Ubuntu 18.04. I did it by add the following line into my
# swap capslock and ctrl
/usr/bin/setxkbmap -option "ctrl:swapcaps"
This worked, but in an awkward way. Every time I logged in by GUI, I need to start a new terminal to activate this setting. And sometimes when I locked the desktop and then logged in back, this setting is deactivated and I had to
source .bashrc to activate it again.
I wanted to find a way to activate this setting automatically upon my logging in by GUI. I searched around and find that there are log-in bash and non-log-in bash. I believe when I logged in by GUI, I actually started a log-in bash. So I put my setting in
~/.profile. But it did not even work any more!
So is there any approach to automating the activating of the setting? And what happened when I logged in by GUI? I mean, if it does not start a log-in bash, how could I start other application on GUI?