Posted by CANbike on Fri, 25 Jan 2013

Puppy Linux: Disable Monitor Sleep Mode

Puppy Linux is a small portable and efficient operating system that runs off a live CD or a USB flash drive. There’s no need for a hard drive.

I like using it for watching online videos, as Adobe Flash Player is either included or automatically installed depending on the Puppy version. However, the automatic monitor sleep mode would activate every 10 minutes without mouse or keyboard input.

To avoid this, I created a little script to deactivate this with a click of the button.


In Linux, xset is used to set various options for the display.

According to the man page the s option

The s option lets you set the screen saver parameters. This option accepts up to two numerical parameters, a 'blank/noblank' flag, an 'expose/noexpose' flag, an 'on/off' flag, an 'activate/reset' flag, or the 'default' flag. If no parameters or the 'default' flag is used, the system will be set to its default screen saver characteristics. The 'on/off' flags simply turn the screen saver functions on or off. The 'activate' flag forces activation of screen saver even if the screen saver had been turned off. The 'reset' flag forces deactivation of screen saver if it is active. The 'blank' flag sets the preference to blank the video (if the hardware can do so) rather than display a background pattern, while 'noblank' sets the preference to display a pattern rather than blank the video. The 'expose' flag sets the preference to allow window exposures (the server can freely discard window contents), while 'noexpose' sets the preference to disable screen saver unless the server can regenerate the screens without causing exposure events. The length and period parameters for the screen saver function determines how long the server must be inactive for screen saving to activate, and the period to change the background pattern to avoid burn in. The arguments are specified in seconds. If only one numerical parameter is given, it will be used for the length. 

and the -dmps option

The -dpms option disables DPMS (Energy Star) features.

Where DPMS stands for Display Power Management Signaling.

Lastly, the q option

The q option gives you information on the current settings.


A simple script “disableSleep” was created using the xset command to disable the monitor’s screensaver and Energy Star sleep mode.

xset s off
xset -dpms
xset q

Simple Status Display

The disableSleep script works well, but it can be awkward going to the command line to activate the script while watching an online video. The solution was to make a desktop icon.

Puppy Linux uses ROX pinboard to handle desktop icons. Dragging the script onto the desktop works, but there’s no display status when executing the script. As result another little script was made to handle this.

This time the command xterm is used.

According to the man page the -hold option

Turn on the hold resource, i.e., xterm will not immediately destroy its window when the shell command completes. It will wait until you use the window manager to destroy/kill the window, or if you use the menu entries that send a signal, e.g., HUP or KILL. 

and the -e option

This option specifies the program (and its command line arguments) to be run in the xterm window. It also sets the window title and icon name to be the basename of the program being executed if neither -T nor -n are given on the command line. This must be the last option on the command line.

The final script xset (off) looks like this

xterm -hold -e /root/Scripts/disableSleep

When executed from the desktop, an xterm window is created to execute the disableSleep script. The window will not be destroyed until the user closes the window.

xset off 1-thumb.pngxset off 2-thumb.pngxset off 3-thumb.png