Swapping the CMD and Control Keys on a Macbook Running Linux
September 19, 2023 —
Gregg Szumowski
I find it annoying not having a CTRL key available for both hands so I tend to swap the Command and CTRL key settings on my 2012 “Slackbook”.
- Launch a terminal
- Edit the X11 Keyboard Extension
# vim /usr/share/X11/xkb/symbols/pc
- Make the following changes. Ensure your file looks like this:
key <LCTL> { [ Super_L ] };
key <LWIN> { [ Control_L ] };
...
key <RCTL> { [ Super_R ] };
key <RWIN> { [ Control_R ] };
- Clear xkb’s cache
# rm -rf /var/lib/xkb/*
- If the keys are not swapped after Step 4, restart your session or your computer.