I have a Thinkpad X230 (german layout, [edit]running linux[/edit]) and I want to switch the left win- and the left alt-key somehow with the right alt-key (AltGr) not being touched.

However, I haven't found a working solution yet. I know the question dealing with exactely this problem here on superuser (How do I swap Alt and Windows keys with xmodmap?), but the xmodmaps there just give me an error:

X Error of failed request: BadValue (integer parameter out of range for operation)

Major opcode of failed request: 118 (X_SetModifierMapping)

Value in failed request: 0x17

Serial number of failed request: 13

Current serial number in output stream: 13

And as the Keyboardmodel is a different one, I don't know which setxkbmap-command is required.

What I tried so far (besides the Xmodmaps in the question mentioned above) is * "setxkbmap -option altwin:swap_lalt_lwin", which does exactely nothing * some xmodmap-variations (unfortunately I do not remember which combinations I tried, however, I wasn't able to make it work), my last status with most of my used commands is this one:

!!Clear Super & Alt

!clear Mod1

!clear Mod4

!remove mod1 = Alt_L

!remove mod4 = Super_L

!keycode 204 = NoSymbol NoSymbol NoSymbol NoSymbol

!keycode 205 = NoSymbol NoSymbol NoSymbol NoSymbol

!keycode 206 = NoSymbol NoSymbol NoSymbol NoSymbol

!keycode 207 = NoSymbol NoSymbol NoSymbol NoSymbol


!keycode 64 = Super_L Super_L Super_L Super_L

!keycode 133 = Alt_L Alt_L Alt_L Alt_L

!keysym Alt_L = Super_L

!keysym Super_L = Alt_L

!Remap Super & Alt

!add mod1 = Super_L

!add mod4 = Alt_L

Is someone experienced in using xmodmap or setxkbmap and can me help out? It would be very appreciated!

Thanks in advance!

1 Answer 1


The solution is clean and a built in function:

setxkbmap -option altwin:swap_lalt_lwin

(I am using it for my Thinkpad X260) on Fedora 27 and the Windowmanager Xmonad, which uses the Super_L key as as ModMask.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.