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

pepo.k
  • 11

1 Answers1

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.

jobin
  • 28,567