Last Updated: August 08, 2018
·
2.224K
· AurelienLourot

Map the Search key to Caps Lock in crouton

Crouton is a nice set of scripts for running Ubuntu on a
Chromebook. These notebooks have a Search key in place of the usual Caps Lock key.

This article describes how to map the Search key to the Caps Lock function in crouton.

Determining the current keycode and keysym

In your chroot, start xev and press the Search key:

$ xev | grep keycode

If you haven't installed the
keyboard target you
should see

state 0x0, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
state 0x40, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,

which means that the key has the keycode 133 and
is associated to the keysym Super_L, which is the
function triggered by the Windows key on other keyboards.

All we now need to do is to associate that same keycode to the Caps_Lock keysym.

Associating Caps_Lock keysym to keycode 133.

You can do so by typing

$ xmodmap -e "keycode 133 = Caps_Lock"

You can now add this line to any autostart script you have in place. Note that this command must
be issued after any setxkbmap command otherwise it will be overriden.

For the record here is the usual way.

Performing association on X server's start

Create a file ~/.Xmodmap containing:

keycode 133 = Caps_Lock

Add the following lines to your .xinitrc:

if [-s ~/.Xmodmap]; then
    xmodmap ~/.Xmodmap
fi

For other configuration tips for crouton, see lourot.com.


// https://github.com/AurelienLourot/crouton-articles/blob/master/crouton-caps-lock.md