system/modules/home-manager/configs/window-manager/scripts/kdb_brightness.sh

31 lines
650 B
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
function SetKeyboardBrightness() {
echo $1 | sudo tee /sys/class/leds/asus\:\:kbd_backlight/brightness
}
min_brightness="0"
max_brightness=$(cat /sys/class/leds/asus\:\:kbd_backlight/max_brightness)
current_brightness=$(cat /sys/class/leds/asus\:\:kbd_backlight/brightness)
case "$1" in
"up")
if [ "$current_brightness" != "$max_brightness" ]; then
let 'current_brightness+=1'
fi
;;
"down")
if [ "$current_brightness" != "$bin_brightness" ]; then
let 'current_brightness-=1'
fi
;;
*)
echo "Usage: $0 {up|down}"
exit 1
;;
esac
SetKeyboardBrightness $current_brightness