Getting ‘Scroll Lock’ to work under Linux

I’ve got a couple of keyboards with Scroll Lock keys that are not functional by default under Linux.
For my Ubuntu systems, the following procedure worked to fix the problem. After this, the LED for scroll lock lights and the key function as expected.

The steps are as follows:

  1. Find an unused modifier with xmodmap -p
  2. Use xmodmap to assign Scroll_Lock to this modifier
  3. Make the change persistent by adding it to your .Xmodmap file

First, use xmodmap -p to identify an unused mod key.
For example,

$ xmodmap -p
xmodmap: up to 4 keys per modifier, (keycodes in parentheses):

shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Control_R (0x69)
mod1 Alt_L (0x40), Alt_R (0x6c), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3
mod4 Super_L (0x85), Super_R (0x86), Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)

mod3 is the open modifier. So, we’ll use it with xmodmap -e :

xmodmap -e "add mod3 =Scroll_Lock"

Capitalization is important, so “Scroll_Lock” has to be written exactly as printed.
You can have a space, or no space, after the equal sign.

Check that it works, then add the command content to your home directory (file does not have to exist):

echo "add mod3 =Scroll_Lock" >> ~/.Xmodmap

Tags: , ,

Leave a Reply

You must be logged in to post a comment.