68

My screen goes black after 30 seconds of inactivity and when I press a key, it shows where it was and does not need any password. This problem won't occur when I use it for watching videos in platforms such as youtube etc. My Ubuntu version is 22.04. I have used some methods to overcome it but still couldn't.

  1. I've changed screen blank to "never" in setting>power>screenBlank
  2. I've used commands such as 'gsettings set org.gnome.settings-daemon.plugins.power idle-dim false', and 'gsettings set org.gnome.desktop.screensaver lock-delay 600' with and without sudo in terminal. I restarted my pc after them just in case. could you please help me with this?

6 Answers6

57

Same problem here, with Ubuntu 22.04 after only 30 second of inactivity the screen turn black, to bring back the display on screen I need to press a key or move the mouse. I have also notice it does not occur when watching video like YouTube.

The work around which work on my side, is to call this command:

xset -dpms
seb
  • 686
19

Give this a try.

xset s off && xset -dpms

I ran it this morning. When I came home, the screen was on standby as it should be instead of just blacked out like it was doing with xset -dpms. I've let it go into standby several more times and it is still working as it should.

I expect this will revert when I reboot. However, if it does, I will just add it to the end of my .profile.

Edit: This fix has worked for me through a logout/login and two reboots.

tbzep
  • 201
  • 2
  • 4
6

not sure what's messing with the DPMS blank time, this worked fine in 20.04.

# export DISPLAY=:0 && /usr/bin/xset dpms 1200 1200 1200
# xset q
....
DPMS (Energy Star):
  Standby: 1200    Suspend: 1200    Off: 1200
  DPMS is Enabled
  Monitor is On

set correctly, but wait a few minutes, screen blanks in way too short a time...

#  xset q
....
DPMS (Energy Star):
  Standby: 0    Suspend: 0    Off: 0
  DPMS is Enabled
  Monitor is On

Something is resetting it to 0 0 0. Poking around...

gessel
  • 179
4

In Menu, go to System Tools » dconf Editor or type dconf-editor in terminal:

org » gnome » settings » daemon-plugins » power » sleep-inactive-ac-timeout

Set sleep-inactive-ac-timeout to 300 (seconds)

Set sleep-inactive-ac-type to ‘logout’

Alexis Wilke
  • 2,787
4

Adding to the answer of @user234899: For me the laptop was not suspending after 30s but the screen was dimmed. To control that timeout:

  1. Open dconf Editor
  2. Navigate to org->gnome->settings-daemon->plugins->power
  3. Set idle-brightness from 30 to e.g. 300 (5min)
0

If you're here with Ubuntu 24.04 you probably run Wayland instead of Xorg and any answers relating to xset are outdated. Check here:

https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/issues/687

Temporary workaround:

Run systemctl restart --user org.gnome.SettingsDaemon.Power.target

Permanent workaround (from above link):

Run this command:

sudo systemctl edit --force --full screenblank-workaround

Fill in this text:

[Unit]
Description=Fix to screen timeout after resume from suspend
After=systemd-suspend.service

[Service] Type=oneshot ExecStart=/usr/bin/systemctl --user -M <your user name>@ restart org.gnome.SettingsDaemon.Power.target

[Install] WantedBy=systemd-suspend.service

Please create a +1 in that gnome ticket so that it gets the attention it deserves.