Last active
October 19, 2016 18:20
-
-
Save StefanoBelli/4b28fa34e8bcf1372ca76950f4d9616f to your computer and use it in GitHub Desktop.
Script used to enable/disable keyboard backlight
This file contains 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/sh | |
LED_VALUE="3" | |
OPTION="$1" | |
if ! which xset 2>/dev/null >>/dev/null; | |
then | |
echo "You need xset in order to set keyboard backlight" | |
exit 1 | |
fi | |
if [[ $OPTION == "--on" ]]; | |
then | |
xset led $LED_VALUE && echo "Keyboard leds turned on! Have fun :P" || \ | |
exit 3 | |
elif [[ $OPTION == "--off" ]]; | |
then | |
xset -led $LED_VALUE && echo "Keyboard leds turned off" || \ | |
exit 3 | |
else | |
echo "Usage: $0 --on|--off" | |
exit 2 | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment