Getting Scroll Lock to Work in Ubuntu

7 04 2008

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 (0×32),  Shift_R (0×3e)
lock        Caps_Lock (0×42)
control     Control_L (0×25),  Control_R (0×6d)
mod1        Alt_L (0×40),  Alt_L (0×7d),  Meta_L (0×9c)
mod2        Num_Lock (0×4d)
mod3
mod4        Super_L (0×7f),  Hyper_L (0×80)
mod5        Mode_switch (0×5d),  ISO_Level3_Shift (0×7c)

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. :)


Actions

Information

8 responses

29 05 2008
Srinivas

Very informative!

19 08 2008
mayurjain

thanks man…i used this info go get my Trendnet KVM switch to work…it uses the key sequence “ScrLock + ScrLock” and my ubuntu wont recognize this…

6 09 2008
proh

for KVM use in Linux try use NumLock instead of ScrLock. But anyway better fix this

3 11 2008
Rich

Thanks a lot, dude!

11 11 2008
Bart

Thanks man !
What a strange bug! I also needed this for my KVM switch

27 03 2009
Mike

Excellent info. I’ve used this in 8.04 to get my KVM working. I’ve recently upgraded to Intrepid Ibex 8.10, and it stopped working again. It appears that Xmodmap is no longer used and this must be taken care of though HAL. I’ve managed to do some tweaks to my mouse with a .fdi file. It looks like the same needs to be done to get scroll lock working again. How about an update here to show us noobs how it’s done? :)

6 05 2009
Soren

Hey

Thanks for the info ! I have used it on a number of Ubuntu 8.04 boxes with success.

However if a make the mod in 9.04 it kills the alt-gr button. (The right alt key, which is frequently used on a danish keyboard layout as mine).

Does anyone know a workaround for this ?

11 05 2009
btxshark

I just upgraded to 9.10 and this will not work. is there a way to do this with newer versions or am SOL. also, i have been having problems with the flash plugins, i am not sure if this is just my hardware (which is very old) or if there is a known bug.

Leave a comment