Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to change the function of scroll lock. After pressing scroll lock, it should turn off the screen (and of course no backlight). I have tried the following:

  1. have set the custom command "xset dpms force off" for the scroll lock in the keyboard shortcuts in ubuntu system. But no effect.
  2. have tried also to set by script using autokey (which I use for other purposes). But no effect.

My target is to make it simple, and not to write some big scripts and to let them load every time I want the screen off.

I have read something about remaping through xmodmap, but... If I use xev in terminal, then after pressing scroll_lock:

FocusIn event, serial 38, synthetic NO, window 0x6200001, mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 38, synthetic NO, window 0x0, keys: 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

FocusOut event, serial 38, synthetic NO, window 0x6200001, mode NotifyNormal, detail NotifyNonlinear

... and there is no info about keycode...

kind regards


share|improve this question
I tried it and I can map the function to other shortcuts with method 1. So not to scroll lock but you can map it to shift-scroll lock. I am not sure whether that is acceptable. – Wouter Dec 21 '13 at 8:41
Hi Wouter, thanks for the hint. I would like to set it to just the scroll lock. Because just pressing "scroll lock" is more accesible and not used by me for other purposes. It is interesting that with shift it is going. For me it looks, that using of scroll lock for some custom action is somehow blocked by some hidden setting. Any other hints how to set it to scroll lock directly? – pepo.k Dec 21 '13 at 16:49

You can set the shortcut to lock screen by typing "System settings" in your dash and then going to Keyboard-> Shortcuts-> System-> Lock Screen

Click on "Lock Screen" once and press the Scroll Lock button. This will set the shortcut for locking your screen to Scroll Lock.

To just turn off your screen, go to System settings-> Keyboard-> Shortcuts-> Custom Shortcut and add your own shortcut key as follows:

Name: Screen off

Command: sh -c "sleep 0.1 && xset dpms force off"

And then set the shortcut by clicking on the new entry made there.

Source: Similar question

You need to give the sleep command to wait for the key press(of the shortcut) to terminate and not have an effect of waking up the screen turning off.

share|improve this answer
Hi Jobin, this is not that what I want. Not the screen lock, but only put the screen to off state. For this I had to create custom action in the keyboard shortcuts... see point 1 – pepo.k Dec 21 '13 at 16:17
hi jobin,my problem is probably somewhere else. Because like wouter said: with ctrl+scroll_lock it is going even without sleep 0.1. But a pure scroll lock is giving no effect. Try it! I cannot even find out through xev in terminal, what keycode has my scroll lock. – pepo.k Dec 22 '13 at 19:20
bump! is there nobody who can help?! – pepo.k Jan 3 '14 at 11:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.