Swap Left Alt with Left Win in Saucy (13.10)
Solution 1
You can use the following commands in terminal to swap Left Alt with Left Super:
xmodmap -e "keycode 64 = Super_L NoSymbol Super_L" #this will make Alt_L to act as Super_L
xmodmap -e "keycode 133 = Alt_L Meta_L Alt_L Meta_L" #this will make Super_L to act as Alt_L
To get this change for every session, after you have run the previous commands create a file called .xmodmap
with the new keymaps, using the following command:
xmodmap -pke > .xmodmap
Then, create a file called .xinitrc
in your home directory, containing the following line/command:
xmodmap .xmodmap
Solution 2
The layout options can be changed in gnome-tweak-tool, in the "Typing" section. The setting to configure "Alt/Win key behavior" is the last one in the list.
Related videos on Youtube
Joni
Updated on September 18, 2022Comments
-
Joni over 1 year
How do I swap the left Alt and the left Super ("windows") keys in Saucy Salamander? I just upgraded and I have noticed the keyboard layout dialog has changed, and I can no longer find the options window. I use this option because occasionally I use a Sun keyboard that has super next to space, which I'm not used to.
-
Radu Rădeanu over 10 yearsWhile your answer is correct and straight to the point, this it can't be generalized to any two keys.
-
Joni over 10 yearsThank you for your answer! Unfortunately I don't find modifying the Xmodmap configuration every time I change keyboards (once or twice per day) very user friendly.
-
Braiam over 10 years@Joni the change is permanent (for your user) if you create the
.xinitrc
file as he indicates -
Joni over 10 years@Braiam, depending on where I am I use the laptop keyboard or the Sun keyboard with the funny layout, which means having to swap or unswap the keys almost every time I start work.
-
Joni over 10 yearsI'm marking this answer as accepted because it's more general and may help future visitors better even if it's not the best solution in my particular case.
-
chrismarx about 10 yearsthe "Typing" section doesn't appear to even be in the gnome-tweak-tool an ymore...
-
Joni about 10 yearsAre you taking about the 14.04 beta @chrismarx? In 13.10 it's there.
-
chrismarx about 10 yearsAh, I'm on 12.04, maybe that's the problem-
-
Joni about 10 yearsI believe in 12.04 this option was in the advanced settings in the main keyboard layout dialog. The advanced settings dialog was removed in 13.10, prompting this question.
-
Khai Dinh almost 8 yearsWorks great for Ubuntu 16.04 using a Mac keyboard
-
totymedli over 5 yearsFor MacBooks also set "Alternative Character Key" to "Right Win" in Settings->Keyboard->Shortcuts->Typing, so you have a traditional AltGr.