I have been trying to switch the Ctrl and CMD key on my MacBook for a while, but nothing seems to work.
A lot of the answers say to go to System Settings > Keyboard Layout and change it there, but I have a brand new installation of Ubuntu, and it does not have that feature.
I've also tried adjusting the xmodmap, which works for the current session, but when I reboot, the settings aren't saved.
To try to save it, I have added the command xmodmap ~/.Xmodmap
to my Startup Applications, but that didn't work. I have also tried adding the command to the file /etc/profile.d/myfile.sh
(I also altered the permissions). I have tried the file ~/.xinitrc
file and many other ways, but nothing seems to work.
However, when I go to my shell and type in xmodmap ~/.Xmodmap
, it works. So, I'm not sure what I'm doing wrong here.
Does anyone have any idea what I'm doing wrong?
The gnome-tweak-tool provides an option "Left Alt is swapped with Left Win". You may install gnome-tweak-tool with
sudo apt install gnome-tweak-tool
and the option can be found in the "Typing" menu.To reload a configuration on login, first save it to the file:
then edit the file created, such as:
or viceversa.
You can run
xev
and press the buttons to verify their keycode.Finally, edit the file
~/.xsessionrc
(or create it if it does not exist) with the following text, and change execution permission:Content of
~/.xsessionrc
file: