Disable laptop screen on Linux

Posted by Eric Scheibler at July 3, 2016

This article describes how to disable the laptop screen on Lenovo Thinkpads. This saves a lot of power and enhances your privacy. Root privileges required. Tested with a Thinkpad T450 on Debian Stretch.

Save the following script under /usr/local/sbin/monitor:

#!/bin/bash
if [ -f /tmp/screen_stays_active ]; then
    echo 0 > /sys/class/backlight/intel_backlight/brightness
    rm /tmp/screen_stays_active
    echo "Disable screen"
else
    echo 850 > /sys/class/backlight/intel_backlight/brightness
    touch /tmp/screen_stays_active
    echo "Restore screen brightness"
fi

and make it executable:

chmod +x /usr/local/sbin/monitor

The laptop monitor enables itself in irregular intervals again. Therefore you may create three cronjobs for the root user which disable the screen every 20 seconds continuously. A script with an endless while-loop certainly would serve the same purpose.

# crontab -e

*  *   *   *   *   if [ ! -f /tmp/screen_stays_active ]; then echo 0 > /sys/class/backlight/intel_backlight/brightness; fi
*  *   *   *   *   sleep 20 && if [ ! -f /tmp/screen_stays_active ]; then echo 0 > /sys/class/backlight/intel_backlight/brightness; fi
*  *   *   *   *   sleep 40 && if [ ! -f /tmp/screen_stays_active ]; then echo 0 > /sys/class/backlight/intel_backlight/brightness; fi

Please note, that the screen is disabled directly after you've created the cronjobs above and it will stay disabled even after reboot.

You may toggle the brightness state with the command sudo monitor. If you don't want to enter a password every time, you may define an exception in the sudoers file. To do so enter the visudo command as root and append the following line:

MY_USER_NAME ALL = NOPASSWD: /usr/local/sbin/monitor

By the way: If you often enable the keyboard backlight accidentally via fn+space and you want to disable that automatically too, add the following cronjob:

# crontab -e

*  *   *   *   *   echo 0 > /sys/class/leds/tpacpi::kbd_backlight/brightness

Find additional information at http://www.thinkwiki.org/wiki/ThinkLight