0

I'd like to switch the 'Command' and 'Alt/Option' keys on my Macbook Pro keyboard.

I have two keyboards: the internal one and an external USB keyboard. I would like them to both have the same behavior.

I'd like Control (and Fn on the MBP internal keyboard) to stay the same.

What is the best way to do this?

This similar to How to swap ctrl and alt keys in ubuntu 16.04? but I want to swap Command with Alt, not with Control.

1 Answers1

1

I just installed Debian on a mid-2012 MacBook Pro and encountered the same problem after looking around for a while. I am very new to this whole Linux business and StackExchange, so bear with me. If you are not familiar with MacBook keyboard like myself, you can use xev to find out their names, keycode, etc.

My keyboard has a similar setup:

[fn] [ control ] [alt/option] [⌘ command] [space] [⌘ command] [alt/option]

Using xev, this is equivalent to:

[fn] [Control_L] [  Alt_L   ] [ Super_L ] [space] [ Super_R ] [  Alt_R  ]

Under /usr/share/X11/xkb/symbols/, you can modify the mapping on different levels, for this answer, I'll just stick with pc.txt. In it, you'll find something like:

key <LFSH> {    [ Shift_L       ]   };
key <LCTL> {    [ Control_L     ]   };
key <LWIN> {    [ Super_L       ]   };
...
key <RTSH> {    [ Shift_R       ]   };
key <RCTL> {    [ Control_R     ]   };
key <RWIN> {    [ Super_R       ]   };
key <MENU> {    [ Menu          ]   };
...
key <ALT>  {    [ NoSymbol, Alt_L   ]   };
include "altwin(meta_alt)"

Then I just swap Alt_L and Super_L, then save, reboot.

muru
  • 207,228