Change Raspberry Pi X Screen Blanking Settings

Altering the screen blanking settings on a Raspberry PI requires a small number of commands. This is assuming that your Raspberry Pi is running the X window manager.

To find out what the current settings are run the command.

xset q

This will show you something like the following.

Keyboard Control:
  auto repeat:  on    key click percent:  0    LED mask:  00000000
  XKB indicators:
    00: Caps Lock:   off    01: Num Lock:    off    02: Scroll Lock: off
    03: Compose:     off    04: Kana:        off    05: Sleep:       off
    06: Suspend:     off    07: Mute:        off    08: Misc:        off
    09: Mail:        off    10: Charging:    off    11: Shift Lock:  off
    12: Group 2:     off    13: Mouse Keys:  off
  auto repeat delay:  500    repeat rate:  33
  auto repeating keys:  00ffffffdffffbbf
                        fadfffefffedffff
                        9fffffffffffffff
                        fff7ffffffffffff
  bell percent:  50    bell pitch:  400    bell duration:  100
Pointer Control:
  acceleration:  20/10    threshold:  10
Screen Saver:
  prefer blanking:  yes    allow exposures:  yes
  timeout:  600    cycle:  600
Colors:
  default colormap:  0x20    BlackPixel:  0x0    WhitePixel:  0xffffff
Font Path:
  /usr/share/fonts/X11/100dpi/:unscaled,/usr/share/fonts/X11/100dpi,built-ins
DPMS (Energy Star):
  Standby: 600    Suspend: 600    Off: 600
  DPMS is Enabled
  Monitor is On

This tells you all sorts of things about your computer, including caps lock status, pointer control and colours. What we are interested in here is "Screen Saver" and "DPMS".

At each point in the instructions below you can run the "xset q" command to see that your changes were saved correctly.

Screen Saver

The screen saver function will activate a screen saver (in this case a blank screen) but will not change the power profile of the screen. To turn the screen saver off entirely run the command.

xset s off

You can also set two numbers.

xset s 60 60

The two numbers here are timeout and cycle, in seconds.

Timeout is the length of time that must elapse before the screen saver is activated. The cycle parameter is how long the screen saver is shown for before it is swapped to another screen saver.

DPMS (Energy Star)

The DPMS features controls the power to the screen.

xset dpms 60 60 60

The numbers here are standby, suspend, off, in seconds.

On an LCD display, these values have no difference at all so the first value reached will cause the screen to power off.

Setting On Boot

All of these settings will be lost when you restart your device. To save them you need to add them to the systems autostart file, which should be in the location "/etc/xdg/lxsession/LXDE-pi/autostart". If it doesn't exist then create it.

To edit the file, run the following.

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart

Add the following lines to the bottom of the autostart file and save it. 

@xset s off
@xset dpms 60 60 60

This will set the screen saver to "off" and will cause the screen to power off after 60 seconds.

The "@" symbol in front of the command means that the command is optional. This means that if the command fails then the system will attempt to run the command 4 more times before giving up. If there is a problem then the system will still boot.

All of these settings have a number of different options that I haven't shown here. For more information please see the xset man page.

Add new comment

The content of this field is kept private and will not be shown publicly.