Swap Left Alt with Left Win in Saucy (13.10)

7,818

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.

Share:
7,818

Related videos on Youtube

Joni
Author by

Joni

Updated on September 18, 2022

Comments

  • Joni
    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
    Radu Rădeanu over 10 years
    While your answer is correct and straight to the point, this it can't be generalized to any two keys.
  • Joni
    Joni over 10 years
    Thank 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
    Braiam over 10 years
    @Joni the change is permanent (for your user) if you create the .xinitrc file as he indicates
  • Joni
    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
    Joni over 10 years
    I'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
    chrismarx about 10 years
    the "Typing" section doesn't appear to even be in the gnome-tweak-tool an ymore...
  • Joni
    Joni about 10 years
    Are you taking about the 14.04 beta @chrismarx? In 13.10 it's there.
  • chrismarx
    chrismarx about 10 years
    Ah, I'm on 12.04, maybe that's the problem-
  • Joni
    Joni about 10 years
    I 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
    Khai Dinh almost 8 years
    Works great for Ubuntu 16.04 using a Mac keyboard
  • totymedli
    totymedli over 5 years
    For MacBooks also set "Alternative Character Key" to "Right Win" in Settings->Keyboard->Shortcuts->Typing, so you have a traditional AltGr.