Skip to content

Instantly share code, notes, and snippets.

@StefanoBelli
Last active October 19, 2016 18:20
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 StefanoBelli/4b28fa34e8bcf1372ca76950f4d9616f to your computer and use it in GitHub Desktop.
Save StefanoBelli/4b28fa34e8bcf1372ca76950f4d9616f to your computer and use it in GitHub Desktop.
Script used to enable/disable keyboard backlight
#!/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