13

When I lock screen, the display does turn black but the display isn't completely off. There is some light coming out of the display in screen lock mode but it get turned off when inactive for 10 minutes as configured from Brightness and Lock setting.

I tried xset dpms force off which completely turn off the display.

Is there any way that when I press Ctrl + Alt + L to lock screen, the screen get locked and the display is completely turned off saving some power.

0

6 Answers 6

10
  1. Go to System Settings --> Keyboard --> Shortcuts,
  2. Create a new Custom Shortcut.
  3. Reassign Ctrl + Alt + L to the following command.

    bash -c "xset dpms force off; gnome-screensaver-command -l"
    
1
  • 1
    Did not work for me as gnome-screensaver wakes up the screen. This one worked bash -c "gnome-screensaver-command -l; sleep 4; xset dpms force off".
    – direwolf
    Jan 14, 2018 at 8:38
8

I am running a script for same problem (source):

#!/bin/bash
sleep 0.5
xset dpms force off
gnome-screensaver-command -l 

This turns monitor off and locks the session. The sleep 0.5 is there to avoid the monitor turning on when you release the Ctrl+Alt keys; maybe you don't need this.

You can try other solution also from there (didn't tried this one yet).

The solution I use is:

  1. I have added the Inhibit Applet to my top panel (this lets me toggle the sleep mode off and on)

  2. In power management I set Put display to sleep when inactive for: 1 minute.

  3. I use the Ctrl+Alt+L (I actually changed my shortcut to Ctrl+Alt+Spacebar) to lock the screen.

So when I am using the laptop the first thing I do is click on my Inhibit Applet in my top panel so my display does not go to sleep in 1 minute of inactivity.

When I am all done and want to lock the screen and turn off the monitor I click on the Inhibit Applet so it allows the sleep timer to work, and I hit my combination of keys to lock the screen Ctrl+Alt+L.

The Screen is locked and in 1 minute the display turns itself off.

2
  • sleep was required for me
    – geekQ
    Apr 18, 2013 at 11:32
  • A one line version which can be directly used: bash -c "sleep 0.5; xset dpms force off; gnome-screensaver-command -l" May 19, 2017 at 14:09
4

Go to System settings > Keyboard > Shortcuts > new Custom shortcut and set command to:

bash -c "xset dpms force off; gnome-screensaver-command -l"

Then set a key combination, for example, ctrl + escape.

It worked on my desktop, but didn't work without the above bash command.

3

I have tried this:

xset dpms force off && gnome-screensaver-command --lock && sleep 10

And it turns off display. Now make file called .turnScreenOff.pl and write this in that file, like using gedit ~/.turnScreenOff.pl

#!/usr/bin/perl

`xset dpms force off && gnome-screensaver-command --lock && sleep 10`;

After that, go to terminal (to open Ctrl+Alt+T) and write in:

chmod +x .turnScreenOff.pl

Now what we will do: is just change lock screen command


first step
To disable use Backspace. Than move on to Custom shuortcuts
second
Set name something like turn screen off and lock screen and set command to perl ~/.turnScreenOff.pl
third
And now select that and press buttons you want to set shortcut to, e.g. Ctrl+Alt+L or whatever you want :-)

Hope this helped.


Result!

2
  • Thank You, but the method I used seems very easy for me. Jan 29, 2013 at 13:56
  • why do you use PERL to call bash commands?
    – Greg
    May 13, 2016 at 10:58
2

Command that worked for me :

#!/usr/bin/perl
`gnome-screensaver-command --lock && sleep 5 && xset dpms force off `;

Somehow the lock command was switching on the screen back. Also the sleep was needed to fire the screen off after a delay.

1

I found help here.

  1. Go to System settings --> Keyboard --> Shortcuts and create a new custom shortcut.
  2. Enter as command: gnome-screensaver-command --lock xset dpms force off
  3. Set as key combination: Str + Alt + L to replace the default lock screen shortcut.

Works with my Lenovo R400, so please try it.

You must log in to answer this question.

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