Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMD & control keys swap in ubuntu

Tags:

ubuntu

xmodmap

I have an Apple keyboard with a cmd key which I'm trying to swap with the control key.

From googleing the problem and searching across the forum I came with a several solutions. Unfortunately none of them worked for me. I've tried using the standard "Keyboard layout", Xmodmap & whatever I came across. The closest I got is swaping them but disabling the arrow keys.

I'm using ubuntu 11.

Hope someone can help me. Thank you in advance.

Edit:

This is my xmodmap result:

    shift       Shift_L (0x32),  Shift_R (0x3e)
    lock        Caps_Lock (0x42)
    control     Control_L (0x25),  Control_R (0x69)
    mod1        Alt_L (0x40),  Alt_R (0x6c),  Meta_L (0xcd)
    mod2        Num_Lock (0x4d)
    mod3      
    mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce),  Hyper_L (0xcf)
    mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)

I want the control to be mod4 and vice versa. Thanks..

like image 385
Phoenix Avatar asked Aug 17 '11 21:08

Phoenix


1 Answers

Depending of your desktop you can find easier or harder solutions for this.

If you have Gnome:

Just open Tweak tool, go to: Typing tab, and choose: Ctrl is mapped to Win keys in Alt/Win key behavior and you are done, is not perfect but works well.

If you have unity or other flavor you need to use Xmodmap, edit your ~/.Xmodmap with this:

remove control = Control_L
remove mod4 = Super_L Super_R

keysym Control_L = Super_L
keysym Super_L = Control_L
keysym Super_R = Control_L

add control = Control_L Control_R
add mod4 = Super_L Super_R

then add this next line to ~/.profile file and log in again.

xmodmap .Xmodmap 

I wrote this How To about this, maybe can help someone. https://chrissmejia.com/howto/swaps-the-ctrl-and-cmd-keys-in-ubuntu/

like image 156
Chriss Mejía Avatar answered Oct 06 '22 01:10

Chriss Mejía