#!/bin/bash

# To the end of /etc/sudoers, add
# ALL ALL = (ALL) NOPASSWD: /usr/bin/tee /sys/class/leds/tpacpi\:\:thinklight/brightness

led="/sys/class/leds/tpacpi::thinklight/brightness"
brightness=0
if grep -q 0 "$led"; then
  brightness=1
fi
echo "$brightness" | sudo /usr/bin/tee "$led"
