168

When I'm watching a film in Mythtv the screen turns to black every 10 - 15 mins and I have to log back into Ubuntu. Very annoying!

How do I disable the black screen / screensaver / logout in Unity?

There no longer seems to be any options to turn the screen saver off as there were in Ubuntu prior to Unity.

2
  • 2
    Follow this instruction: How to Disable Screensaver/Lock Screen/Sleep Mode in Ubuntu?
    – user141261
    Mar 18, 2013 at 3:51
  • 1
    As of 18.04 the screensaver and lock screen settings are located in two separate locations. The screensaver setting is located in Settings -> Power -> Power saving. The lockscreen setting is located in Settings -> Privacy -> Screen lock. If you only turn off the lock screen, the screen itself will still come up, just no login prompt to make it go away. Jul 8, 2019 at 13:26

10 Answers 10

162
  • Go to System Settings...Brightness and Lock:

    enter image description here

  • The default screensaver idle time is 10 minutes, and the screen is locked once the screensaver activates:

    enter image description here

  • You can adjust the idle time (or disable the screensaver), and also disable the lock:

    enter image description here

  • Simply close Brightness and Lock to apply the new settings.

11
  • 21
    This does not work. The X server has a separate setting that still causes the monitor to turn off after N minutes of inactivity.
    – Cerin
    May 2, 2013 at 10:47
  • 5
    And how do you disable that setting?
    – matteo
    Oct 24, 2013 at 18:18
  • 12
    And why on earth is this non-working answer marked as answer?
    – matteo
    Oct 24, 2013 at 18:18
  • 4
    What I wonder is why this setting group is called "Brightness and Lock", when it has not much to do with brightness..
    – Claudiu
    Oct 15, 2014 at 17:41
  • 4
    Now (as of 17.10) it is under Privacy menu
    – Suncatcher
    Apr 19, 2018 at 18:43
57

If you want to wrap your app in a script that takes care of this for you when you launch it (or GUI simply isn't an option), the best command-line solution as of Ubuntu 14.04 is:

To disable the screen blackout:

gsettings set org.gnome.desktop.session idle-delay <seconds> (0 to disable)

To disable the screen lock:

gsettings set org.gnome.desktop.screensaver lock-enabled false

You probably want to add their inverses at the end of the wrapper script to return your system to normal behavior on exit. In such a case, you want to prevent against ungraceful termination (i.e. interrupt, or SIGTERM during system shutdown), so create a function to restore normal behavior and use trap <function> 0 (for bash-type shells) to catch exits and apply the restoration functions.

6
  • 4
    works on ubuntu 16.04 (with unity DE)
    – Felipe
    May 17, 2016 at 20:57
  • 1
    Is there a way to do this via SSH? I'm trying to disable the screensaver on my office computer while at home. When I run the code you wrote I get this error: (process:7353): dconf-WARNING **: failed to commit changes to dconf: Cannot autolaunch D-Bus without X11 $DISPLAY
    – AnnanFay
    May 26, 2017 at 18:24
  • 1
    @Annan I have the same question, currently all I've found is askubuntu.com/a/743024/358498 which is quite convoluted
    – tyleha
    Nov 30, 2017 at 0:30
  • 1
    For your proposes the simplest approach would be to just kill the screensaver process, then start it up again when you return to your office. "pkill screensaver". Sometimes a hammer is the best tool for the job. Dec 2, 2017 at 20:05
  • 2
    This also works on Ubuntu 18.04.1 LTS
    – Joe Jordan
    Dec 27, 2018 at 17:25
31

To disable the automatic screen lock in Ubuntu 14.10 Gnome, these are the necessary steps:

  1. Start the application "Settings"
  2. Choose "Privacy" under the "Personal" heading
  3. Choose "Screen Lock"
  4. Toggle "Automatic Screen Lock" from the default "ON" to "OFF"

To make this answer more useful as a Google search result for common search terms such as "disable lock screen ubuntu" (how I found this page), I've added this answer to extend the context of this page to include the steps to disable the automatic screen lock in Ubuntu 14.10 Gnome. System Settings (called simply "Settings" in Ubuntu 14.10 Gnome) are organized slightly differently within Ubuntu 14.10 Gnome than as described by the answer listed above, requiring a different user flow.

4
  • 3
    Only answer works on Ubuntu 14.10 with Gnome 3. Feb 12, 2015 at 20:56
  • 3
    Vote this up! It is the only one that works on 16.04! Jun 27, 2016 at 18:14
  • 2
    worked for me for Ubuntu 18+, other answer did not work for me Aug 6, 2019 at 8:17
  • It works on 18.04 and 20.04 Mar 25, 2021 at 14:48
11

If the unity gui doesn't work, then you could try using xset

Open a terminal and type:

xset s off

To also prevent the display from blanking and to prevent the monitor's DPMS energy saver from kicking in, add the following:

xset s noblank
xset -dpms

Also try some things here:

https://wiki.archlinux.org/index.php/Display_Power_Management_Signaling#xset_screen-saver_control

1
  • 1
    Works on Ubuntu 16.04. The only (non-GUI) method that worked (of the presented here).
    – LRDPRDX
    Nov 15, 2018 at 3:53
4

Consider this dialog:

enter image description here

this is not essentially a screensaver but it serves same function.

2
  • I wonder why I do not have the "Dim screen when inactive" setting? I have the latest updated ubuntu Feb 1, 2020 at 17:32
  • Robert, i have no idea
    – stiv
    Feb 2, 2020 at 8:53
3

Only caffeine extension worked for me in Ubuntu 19.04 to disable automatic screen lock and have manual locking still working.

This is disable locking screen alltogether, so is not good:

gsettings set org.gnome.desktop.lockdown disable-lock-screen 'true'
1

For me on kubuntu 16.04 (plasma) I have to go to System Settings -> Workspace -> Desktop Behavior -> Screen Locking -> turn off 'Lock screen automatically after'

On kubuntu 18.04 I find, K-menu -> Settings -> System Settings -> etc (see above).

0

On Ubuntu 16.04 you have to go to System Settings -> Screensavers and switch to Settings tab:

enter image description here

Over there you can disable several types of locking.

2
  • I can't find Screensavers in Settings. My OS is Ubuntu 16.04 LTS
    – Serhiy
    Feb 28, 2018 at 18:01
  • @Serhiy: I am checking now, and the Screensavers option is gone. It probably happened after some System Settings update or due to other customizations.
    – noded
    Apr 23, 2018 at 14:10
0

Yet another potentially useful solution, along the lines of caffeine, is xssproxy. From its description in synaptic:

For example Firefox uses the org.freedesktop.ScreenSave D-Bus interface to disable the screensaver when playing videos. This package implements that interface and disables the X built-in screensaver in that case.

Like with caffeine, you'll need to run it when your X session starts.

0

I found that this works on Ubuntu 18:

# Configure dconf to disable screen lock
sudo mkdir -p /etc/dconf/profile/
sudo tee /etc/dconf/profile/user <<EOF
user-db:user
system-db:local
EOF

sudo mkdir -p /etc/dconf/db/local.d/
sudo tee /etc/dconf/db/local.d/10disable-lock <<EOF
[org/gnome/desktop/session]
idle-delay=uint32 0
EOF

sudo dconf update

You must log in to answer this question.

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