1

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

Pepo

2
  • 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, 2013 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, 2013 at 16:49

1 Answer 1

0

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.

4
  • 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, 2013 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, 2013 at 19:20
  • bump! is there nobody who can help?!
    – pepo.k
    Jan 3, 2014 at 11:23
  • Works fine on 16.04, using just the scroll lock key for custom shortcut.
    – Cas
    Jan 28, 2017 at 15:50

Not the answer you're looking for? Browse other questions tagged .