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.

  • What do you mean by Command (or Option)? Are you possibly talking about the Compose key? Also, which of the Alt keys (left or right)? It would also help if you could run the command setxkbmap -query -v 10 and show us what it outputs by editing your question. – Gunnar Hjalmarsson Jun 15 '17 at 07:01
  • The keys on my MBP are labeled:

    fn | control | option (with alt above) | command (with a symbol above) | (space) | ...

    I'd wanted to switch the 2nd and 3rd.

    – Michael Jun 27 '17 at 19:49
  • @Michael did you ever get this sorted and if so how? – tocallaghan Sep 22 '17 at 01:51

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
  • 197,895
  • 55
  • 485
  • 740