Tag Archives: keyboard

Getting Scroll Lock to Work in Ubuntu

For some odd reason the Scroll Lock button doesn’t work in an Xsession in Ubuntu. There’s an old bug report here. However it works as it should in a virtual terminal. 😕 The interesting thing though is that Xev will detect the key press. So how do you get the Scroll Lock functioning again? Well first let’s run this command

xmodmap -pm

You should get an output like this

xmodmap:  up to 3 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
lock        Caps_Lock (0x42)
control     Control_L (0x25),  Control_R (0x6d)
mod1        Alt_L (0x40),  Alt_L (0x7d),  Meta_L (0x9c)
mod2        Num_Lock (0x4d)
mod4        Super_L (0x7f),  Hyper_L (0x80)
mod5        Mode_switch (0x5d),  ISO_Level3_Shift (0x7c)

Notice mod3 has nothing listed.  This will be what we will use to assign Scroll Lock.  It may be a different mod for some people.  Either way use the one that has nothing listed.

Before we do anything else let’s test this to make sure it works.  We’re going to run this command

xmodmap -e ‘add mod3 = Scroll_Lock’

Replace mod3 with whatever the blank mod listing was.  Your Scroll Lock should work now.

I hate making changes like this locally to only my user, so I’m going to do this globally.

Now we need to create a file in /etc/X11 called Xmodmap.  So start up Gedit or your favorite text editor

gksudo gedit /etc/X11/Xmodmap

Now add this to the file

add mod3 = Scroll_Lock

again, change mod3 to the one that was empty from the first command.  Now the Scroll Lock key should get set when X starts now. 🙂