59

I looking for a method to turn-off the screensaver and powermanager but from the command line.

I'm aware this can be done via the GUI screen - but can this be done via the command line or via some configuration editor?

Here is the gui way (via the "screen" or "brightness and lock" application):

enter image description here

rogerdpack
  • 1,029
Takkat
  • 144,580

11 Answers11

45

For 11.10

Disable the GNOME Settings Deamon's power plugin from the command line:

gsettings set org.gnome.settings-daemon.plugins.power active false

Alternatively, using dconf-editor from the dconf-tools package:

enter image description here

For the screensaver:

gsettings set org.gnome.desktop.screensaver idle-activation-enabled false

Or again via dconf-editor:

enter image description here

fossfreedom
  • 174,526
htorque
  • 66,086
13

You might find that the above solution is necessary, but not sufficient. The screen might still be blanking after 10 minutes. This is a default setting compiled into Xorg.

To disabled it for the current session, run:

xset s off

You can put this in your .xsession file to disable it upon every login.

Thomas
  • 438
8

You didn't specify if you want permanent solution or temporary solution. If you want to turn off screensaver and power management for e.g. 2 hours, you can simply inhibit those features.

In practice, you can simply run

systemd-inhibit sleep 2h

As an alternative, you may want to inhibit screensaver and power management until a given process has completed. For example,

systemd-inhibit wget "https://example.com/files/huge-download.dat"

would inhibit screensaver and power management until download has finished.

See man systemd-inhibit for more details. It allows you do disable only selected features and allows setting user visible string to explain why these features are inhibited (nice if your system has multiple users).

7

Make a plain text doc in your home folder and copy this into it.

#!/bin/bash
sleep 10 &&
xset s 0 0
xset s off
exit 0

Save the document as "screensaver_off.sh" (without quotes), then open a terminal and enter

chmod +x screensaver_off.sh

Then open up startup applications from the dash, click on the add button, name your start up application, and enter your command as:

"sh /home/$LOGNAME/screensaver_off.sh"

Then add a description and click add, reboot and your done, No more screen blanking.

You will have to do this per each user as default settings revert after logout or reboot.

enter image description here

dginsd
  • 601
4

After reading huge amounts of forum posts, I eventually managed to get rid of it by setting crontab to run every 4 minutes command:

DISPLAY=:0.0 xset s activate

you can leave DISPLAY=:0.0 out, if you have logged in with ssh as a same user which uses gnome.

xset s off didn't help in my case. I have to run that every 4 minutes, to prevent screen saver coming on every 5 minutes. :)

Takkat
  • 144,580
3

You can go to System preferences. There is a program called "Brightnes and lock" (Im not shure how it is called in english. Look at my screenshot) In this menu you can define, when the screenlock is activatet.

enter image description here

Evenbit GmbH
  • 4,726
3

Here is a solution that worked for me .. The problem I had was as I upgraded my Ubuntu 12.04 to 12.10 and to Gnome 3.6 the screen went black when idle for like 5 minutes even if I did not have any conventional settings for an active screen saver, needless to say it was sickeningly annoying ..

Here is the solution I used and it worked (and I have tried a lot of different things, spending too much time searching on startpage.com (google)

Scroll down to 'No screensaver in GNOME 3.2'.

http://www.webupd8.org/2011/10/things-to-tweak-after-installing-ubuntu.html

3

Unchecking the "Dim screen to save power" is possible with

gsettings set org.gnome.settings-daemon.plugins.power idle-dim false

and setting the "Turn off after" to "Never" with

gsettings set org.gnome.desktop.session idle-delay 0

The last command was completely sufficient for my needs.

Mojo
  • 89
2

Disabling Screensaver on Linux Environment from VNC Viewer enter image description here

Abhijeet
  • 121
  • 3
1

Thomas answer above works, but not everyone has .xsession file. You can use your .profile instead. Just add the lines below to the end of the .profile in your Home folder.

# Turn off screen blanking xset s off && xset -dpms

If you don't see .profile, open your Home folder in your file browser, click on 'View' and select 'Show Hidden Files'. Then just right click on .profile, select 'Open with text editor', copy and paste the above on a blank line at the end of the file and save the modified file.

rjd
  • 79
0

I used dconf instead of gsettings which was readily available in Ansible.

Disable screensaver lock:

dconf write /org/gnome/desktop/screensaver/lock-enabled false

Read screensaver lock value:

dconf read /org/gnome/desktop/screensaver/lock-enabled
Martin Tapp
  • 101
  • 2