Map AltGr to Alt on Linux

All I wanted was to make my AltGr key to work the same as my Alt key…

As my poor hands continue to struggle with RSI, I’ve been looking at ways to make my typing more efficient. One thing that occurred to me was to fix something that had bugged me for ages: the fact that I never use AltGr on my keyboard. Things would be easier if it acted like Alt. It would certainly make it more comfortable to hit M-x and M-g in Emacs

And so I searched and searched for ways to do this. The simplest way I found was to type the following command into the terminal:

setxkbmap -option altwin:meta_alt

But how to run that at startup?

My Arch Linux setup uses the i3 window manager, which is called from ~/.xinitrc. Adding setxkbmap -option altwin:meta_alt to the beginning of ~/.xinitrc did the trick.

That doesn’t work on Ubuntu 16.04, however. The easiest way there is to use dconf editor.

sudo apt-get install dconf-editor if you’ve not already got it, then navigate to org|gnome|desktop|input-sources and choose xkb-options.

Insert the following in the value box: ['altwin:meta_alt']

… and that’s it.

Leave a Comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.