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..
EDIT: Just realized that this post was from six months ago. I doubt this will be any help, as you've probably (hopefully!) already gotten this solved, but, whatever.
Here's what you need to do:
Add the following to your ~/.Xmodmap
file:
clear control
clear mod4
keycode 105 =
keycode 206 =
keycode 133 = Control_L NoSymbol Control_L
keycode 134 = Control_R NoSymbol Control_R
keycode 37 = Super_L NoSymbol Super_L
add control = Control_L
add control = Control_R
add mod4 = Super_L
To test this right now, just do xmodmap ~/.Xmodmap
Now, to have this happen every time at startup, add to the end of your (and/or create a new) ~/.xinitrc
file the following:
xmodmap /home/your_username/.Xmodmap
Now restart / logout / restart X and you should be swell! Any trouble, please comment.
Here's what I sometimes use to swap the control and caps-lock keys. It sounds like you've already tried similar things, but maybe you can hack this into something that will work.
To use this, you'd need to know xmodmap's name for the command key. The xev
command, if you have it, might be useful for figuring this out.
#!/bin/sh
xmodmap - <<EOF
remove Lock = Caps_Lock
remove Control = Control_L
keysym Control_L = Caps_Lock
keysym Caps_Lock = Control_L
add Lock = Control_L
add Control = Control_L
EOF
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/
This solution for change the keyboard permanently is better than other solution because for example if you change the language or reset your computer you must renew the Xmodmap command for update keyboard
but by this solution " Permanent xmodmap in Ubuntu 13.04 " your keyboard's map will change for ever.