Skip to content

Instantly share code, notes, and snippets.

@ccfiel
Created August 7, 2019 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ccfiel/fbe00743fe4f3a049ac43cfcc3247f6c to your computer and use it in GitHub Desktop.
Save ccfiel/fbe00743fe4f3a049ac43cfcc3247f6c to your computer and use it in GitHub Desktop.
#!/bin/bash
WORKDIR=/home/chris/
LOGFILE=/tmp/backlight.log
KBDBACKLIGHT=`cat /sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight/brightness`
HOUR=`date +%H`
echo "---------------->" | tee -a $LOGFILE
date | tee -a $LOGFILE
if [ $HOUR -lt 6 -o $HOUR -gt 19 ]; then
echo "HOUR $HOUR must turn on backlight" | tee -a $LOGFILE
BACKLIGHT=3
else
echo "HOUR $HOUR must turn off the backlight" | tee -a $LOGFILE
BACKLIGHT=0
fi
if [ $KBDBACKLIGHT -ne $BACKLIGHT ]; then
echo "Current backlight $KBDBACKLIGHT is different from desired backlight $BACKLIGHT" | tee -a $LOGFILE
echo $BACKLIGHT > /sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight/brightness
else
echo "Current backlight $KBDBACKLIGHT is the same from desired backlight $BACKLIGHT" | tee -a $LOGFILE
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment