How to permanently disable monitor power saver using the command line?
This will work. Open terminal in the /etc/xdg/autostart
directory.
Issue this command:
sudo -H gedit nodpms.desktop
Hit enter, you will have to input your password. Gedit will open, copy and pasted the following code in and then save.
[Desktop Entry]
Type=Application
Exec=xset -dpms
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=nodpms
Name=nodpms
Comment[en_US]=
Comment=
Issue this in the still open terminal:
sudo -H gedit noscreenblank.desktop
Hit enter, you will have to input your password. Gedit will open, copy and pasted the following code in and then save.
Exec=xset s off
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_US]=noscreenblank
Name=noscreenblank
Comment[en_US]=
Comment=
Close the terminal. Open the file browser and navigate to the etc/xdg/autostart directory. Ensure that the files, nodpms.desktop and noscreenblank.desktop are there. If so, close everything and then reboot.
After reboot you can run an xset q
command in terminal and see that dpms and screen blanking are turned off.
#!/bin/bash export DISPLAY=:0.0 if [ $# -eq 0 ]; then echo usage: $(basename $0) "on|off|status" exit 1 fi if [ $1 = "off" ]; then echo -en "Turning monitor off..." xset dpms force off echo -en "done.\nCheck:" xset -q|grep "Monitor is" elif [ $1 = "on" ]; then echo -en "Turning monitor on..." xset dpms force on echo -en "done.\nCheck:" xset -q|grep "Monitor is" elif [ $1 = "status" ]; then xset -q|sed -ne 's/^[ ]*Monitor is //p' else echo usage: $(basename $0) "on|off|status" fi
Save this script in something like /usr/bin
, give it a name (like switch_dpms
) and make it executable with chmod 664 /usr/bin/switch_dpm
.
Now all you need to do is add it to a cron job. So open your crontab file with:
crontab -e
and add this at the bottom:
@reboot /usr/bin/switch_dpms off
Every reboot it will turn dpms
to off
and you can also turn it on
from commandline by doing /usr/bin/switch_dpms on
or check its status with /usr/bin/switch_dpms status
.
Source for the script
The solution to the screen blanking problem is simple once the right option is found. This has to do with power saving, but it isn't in an obvious place.
In 12.04 Gnome go to:
Applications > System tools > System Settings.
Select Brightness and Lock.
Uncheck the box for Dim screen to save power.
Next to the Turn screen off when inactive for option, select the amount of time before the screen is turned off. I selected 1 hour. Never is one selection that is available.