Gregg's MOTD

Tips & Tricks that I've Encountered Over the Years...

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”.

  1. Launch a terminal
  2. Edit the X11 Keyboard Extension

# vim /usr/share/X11/xkb/symbols/pc

  1. 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 ] };

  1. Clear xkb’s cache

# rm -rf /var/lib/xkb/*

  1. If the keys are not swapped after Step 4, restart your session or your computer.

Tags: cli, slackware, xkb, motd