Skip to content

Instantly share code, notes, and snippets.

@RafikFarhad
Last active February 26, 2019 21:47
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 RafikFarhad/5aae0be5a431c469e7d68ee60f70465d to your computer and use it in GitHub Desktop.
Save RafikFarhad/5aae0be5a431c469e7d68ee60f70465d to your computer and use it in GitHub Desktop.
# Asus Vivobook Keyboard Light
#!/bin/bash
brightness=$(cat "/sys/class/leds/asus::kbd_backlight/brightness")
# a=$((brightness-1))
if [ "$brightness" -gt 2 ]
then
a=0
echo $a >> /sys/class/leds/asus\:\:kbd_backlight/brightness
elif [ "$brightness" -gt 0 ]
then
a=$((brightness+1))
echo $a >> /sys/class/leds/asus\:\:kbd_backlight/brightness
else
a=1
echo $a >> /sys/class/leds/asus\:\:kbd_backlight/brightness
fi
@RafikFarhad
Copy link
Author

RafikFarhad commented Feb 26, 2019

Asus Vivobook Keyboard Light

Code

  • Put it on ~/.scripts/
#!/bin/bash
brightness=$(cat "/sys/class/leds/asus::kbd_backlight/brightness")
# a=$((brightness-1))
echo $a
if [ "$brightness" -gt 2 ]
then
a=0
echo $a
echo $a >> /sys/class/leds/asus\:\:kbd_backlight/brightness
elif [ "$brightness" -gt 0 ]
then
a=$((brightness+1))
echo $a >> /sys/class/leds/asus\:\:kbd_backlight/brightness
else
a=1
echo $a >> /sys/class/leds/asus\:\:kbd_backlight/brightness
fi

Todos

  • chmod +x ~/.scripts/kbd_leds.sh
  • chmod 666 /sys/class/leds/asus\:\:kbd_backlight/brightness
  • sudo apt-get install xbindkeys xbindkeys-config
  • xbindkeys -d > /home/$USER/.xbindkeysrc
  • xbindkeys-config

Instruction for saving Key Binding

  • A window will open
  • Click on "New" at the bottom
  • Choose a name for your function, and type that name in the box on the upper right under "Edit" in the space next to "Name:"
  • Click on "Get Key" just slightly below where you typed the function name a window will open on the desktop
  • Press the key you want to assign the keyboard backlight lowering function to (I chose F7 on the top row of the keyboard, with the Fn key)
  • Next type the location of your script for lowering the keyboard brightness in the box next to "Action:", in the space where it says "Command" /home/$USER/.scripts/kbd_leds.sh
  • Click Apply, then click Save & Apply & Exit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment