Bits and Bytes

Notes from the deviant pursuits of a technical vagrant

Remapping the Right-Alt Key in Colemak

Overview

When using Colemak on Ubuntu, by default the right-alt key is mapped to "Level 3 shift." An unfortunate side effect is that when alt-tabbing, you are unable to use the right-alt key.

Solution

I Spent a lot of time looking at different possible solutions (setxkbmap stuff mostly), but eventually I found a way to use xmodmap to set the value of the key to the right-alt key.

To switch to the Colemak layout, enter the following in a shell:

setxkbmap us -variant colemak

Alternatively, you can set the layout using System Settings.

Next, find the keycode of the right-alt key. I inspected the keymap through system settings [add supporting how-to workflow] and observed that the right-alt key is remmapped to a "Level 3 Shift" in the Colemak layout.

The keycode of the "Level 3 Shift" key can be found by running the following command in a shell:

xmodmap -pke | grep Shift

In my case, the keycode is 108.

This key can be remapped to the righ-alt key using the xmodmap tool (as shown in [1] and [2]) by running the following command in a shell.

xmodmap -e "keycode 108 = Alt_R Meta_R Alt_R Meta_R"

This command can be executed automatically each time the computer boots by adding a startup command, as described in [3].

Comments

comments powered by Disqus