Switch off screen and lock screen automatically?


So I’ve bee fiddling with the settings on Lubuntu 20.04 but can’t get to make it behave like Ubuntu 20.04 default when the computer goes idle, switching off the monitor automatically and then ask for user password again when I move the mouse or press a keyboard key.

In other words, I was able to make Lubuntu switch off the screen automatically after “x” minutes, but can’t make it ask for user password again later. It logs on to the current user where I left off.


It might help if you tell us how you got the screen to switch off.

Did you just set xscreensaver to show no screensaver? as I believe it’ll then show no screensaver so screen just goes dark & into power save mode, but should ask for password on mouse movement or keyboard strike on your return, or do something else?

1 Like

I have been fiddling with only two configuration settings: Screensaver and Power Management.

I have successfully switched off the monitor completely only from Power Management settings (idle tab → when idle then: turn off monitor), but that doesn’t lock the screen to ask for user password later.

The only way I could successfully lock the screen was from Screensaver settings, but I couldn’t make Lubuntu switch off the monitor completely.

The other attempt was setting Screensaver to lock the screen after say “1” minute(s) of inactivity, and then set the Power Management to switch off monitor after “2” minute(s) of inactivity, but apparently the Screensaver settings override the Power Management settings and I wasn’t able to get the monitor to switch off completely.

So what can I do? I need Lubuntu to both lock the screen and switch off the monitor completely like Ubuntu does by default.

The thing that sucks here is that while xscreensaver has some power management features (none of which are actually enabled by default), disabling the screen is not one of them. It can “blank the screen” but all that means is that it basically rewrites the screen with blackness before starting the screensaver or just staying that way if it’s set to blank only.

Additionally sucky is that lxqt-powermanagement can handle both locking and disabling the screen, but it cannot accomodate multiple actions. Because of this, I have made an upstream feature request.

Luckily, I managed to find a solution. You were on the right track, actually, but had too big of a time gap. If you can actually disable the monitor between the blanking and the screensaver starting, you’ll be set. Here’s how:

  • In xscreensaver:
    1. blank the screen after 1 minute
    2. cycle after 0 minutes (probably unnecessary but it doesn’t hurt)
    3. check the box to lock the screen after 0 minutes
  • In the “Idle” section in lxqt-powermanagement:
    1. Set it to “Turn off the monitor(s)” when idle
    2. Set idle time to 1 minute and 5 seconds

NOTE: If you have no password set, locking won’t work no matter what you do.


Thank you wxl, but upon fiddling some more I was able to make xscreensaver both lock the screen and turn off the monitor at the same time.

In Display Modes tab:

  1. Mode: Blank Screen Only
  2. Blank After 1 minute
  3. Cycle After 0 minutes (unnecessary)
  4. Check the box to lock the screen after 0 minutes

In Advanced tab:

  1. Check the box “Power Management Enabled”
  2. Standby After: 0 minutes (unnecessary)
  3. Suspend After: 0 minutes (unnecessary)
  4. Off After: 0 minutes (optional - same as “Quick Power-off in Blank Only mode”)
  5. Check the box “Quick Power-off in Blank Only mode”

In lxqt-powemanagement, I actually unchecked “Enable Idleness Watcher” completely.

1 Like

Oh maybe that “Quick Power-off in Blank Only mode” is the key. I had interpreted that as powering off the whole machine.

Yeah no problem.

The only issue though is it’s going into blank screen mode even if a video is playing on full-screen in browser, like on Youtube for example. This behavior does not occur if playing video files on full-screen in VLC, just the browser.

1 Like

When in doubt, consult the documentation:

1 Like

Thanks again!

I have read the documentation but at least my xscreensaver (Lubuntu 20.04 with LXQt) doesn’t blank the screen if a dedicated video player like VLC is in full-screen mode.

It only ignores video in full-screen when in browser like Mozilla Firefox, but haven’t tested other browsers yet.

Anyways this is a very good Linux distribution overall. So clean, eye-candy and snappy!

1 Like

Hahahah maybe I should read the documentation I recommend. That fix is in 5.45 which isn’t available yet.

There’s some suggestions here:

The basic idea that jives with me is to create a script that:

  1. disables xscreensaver
  2. starts vlc
  3. enables xscreensaver when vlc closes

And then use that script to run VLC. If you’re doing this all graphically, that would mean changing the value of the Exec key in the Desktop Entry to point to the script.

And then when 5.45 is available (not even yet in the development version, so we probably won’t see it until 21.10 I’m thinking, though it’s in Debian right now so it may yet end up in 21.04), you can revert back.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.