Guide How to disable the screensaver on Raspberry Pi?

The classic way to disable the screensaver on a Raspberry Pi running Raspberry Pi OS (formerly known as Rasbian) is to add the following lines to the /home/pi/.config/lxsession/LXDE-pi/autostart file:

@xset s noblank
@xset s off
@xset -dpms

Let's explore each of these lines.

Each line essentially executes xset, which is a utility that sets preferences for the X Windows system.

  • The s argument tells X Windows that you are adjusting screensaver defaults.
  • s noblank is to let X know that it should not blank the screen after a certain amount of time.
  • s off disables the screensaver.
  • -dpms disables Energy Star DPMS features.

DMPS and noblank are related to powersaving and display deactivation signaling. The screen saver is a related but separate feature that typically shows a pattern that helps avoid screen burn-in.

Note that autostart file is in the home directory of the default user. For most situations, this should be safest and sufficient. If you have multiple users, you can add the autostart file to all user accounts that need to disable screensaver or alternatively, add the three lines globally to the /etc/xdg/lxsession/LXDE-pi/autostart This disables screensaver and blanking for all users.

For older versions of Raspbian (pre-2015 or so) the location of the file is: /etc/xdg/lxsession/LXDE/autostart

If for some reason, xset is not installed, you can install it with a typically apt command:

apt-get install x11-xserver-utils