Created
December 15, 2017 12:23
-
-
Save SergioGeeK7/27f272385c60af879bf99d064ad63205 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| VALUE=$(cat /sys/class/leds/smc::kbd_backlight/brightness) | |
| INCREMENT=32 | |
| TOTAL=unset | |
| case $1 in | |
| up) | |
| TOTAL=`expr $VALUE + $INCREMENT` | |
| ;; | |
| down) | |
| TOTAL=`expr $VALUE - $INCREMENT` | |
| ;; | |
| full) | |
| TOTAL=255 | |
| ;; | |
| off) | |
| TOTAL=0 | |
| ;; | |
| esac | |
| if [ $TOTAL == unset ]; then | |
| echo "Please specify up, down, full, or off" | |
| exit 1 | |
| fi | |
| if [ $TOTAL -gt 255 ]; then TOTAL=255; fi | |
| if [ $TOTAL -lt 0 ]; then TOTAL=0; fi | |
| echo $TOTAL > /sys/class/leds/smc::kbd_backlight/brightness | |
| #sudo visudo sergiogeek7 ALL=NOPASSWD:/usr/local/bin/keyboard-backlight up, /usr/local/bin/keyboard-backlight down | |
| #Increase backlight keyboard: sudo keyboard-backlight up | |
| #Decrease backlight keyboard: sudo keyboard-backlight down | |
| #Increase to total value of keyboard backlight: sudo keyboard-backlight total | |
| #Turn off backlight keyboard: sudo keyboard-backlight off |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment