Night Backlight

Created: 2022-10-02

Linux: Slackware 15.0. (My main Slackware page.)

Laptop: Lenovo 11e ("Thinkpad")

For my Assembly Nights 2 setup, I’m often booting up my laptop at night and I want a no-fuss way to ensure that the backlight is set comfortably low so I can get to sleep.

With just a wee bit of experimentation, I found the backlight setting for this machine here:

/sys/class/backlight/intel_backlight/brightness

And writing smaller values would, indeed, dim the backlight.

So I finally got the "bright" idea to check the time at boot and if the hour is sufficiently late, dim the backlight. Works great!

$ cat /etc/rc.d/rc.local
#!/bin/bash

if [[ $(date +%H) -ge 20 ]]
then
  echo "Night time backlight!"
  echo 1000 > /sys/class/backlight/intel_backlight/brightness
fi