Skip to content

Instantly share code, notes, and snippets.

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 anibalardid/21230e4c6bd120e8b5767fc7c256a4a0 to your computer and use it in GitHub Desktop.
Save anibalardid/21230e4c6bd120e8b5767fc7c256a4a0 to your computer and use it in GitHub Desktop.
brightnes keyboard backlight in ubuntu
Probar encendido:
echo 3 > /sys/class/leds/asus::kbd_backlight/brightness
Probar apagado:
echo 0 > /sys/class/leds/asus::kbd_backlight/brightness
(1)Crear 2 scripts:
nano /home/anibal/leds_down.sh
Code:
#!/bin/bash
brightness=$(cat "/sys/class/leds/asus::kbd_backlight/brightness")
a=$((brightness-1))
if [ "$brightness" -gt 0]
then
echo $a >> /sys/class/leds/asus\:\:kbd_backlight/brightness
fi
then create the script to raise the brightness:
Code:
nano /home/anibal/leds_up.sh
with this code:
Code:
#!/bin/bash
brightness=$(cat "/sys/class/leds/asus::kbd_backlight/brightness")
a=$((brightness+1))
if [ "$brightness" -lt 3]
then
echo $a >> /sys/class/leds/asus\:\:kbd_backlight/brightness
fi
now change their permissions so that they are executable:
Code:
chmod +x /home/anibal/leds_down.sh
chmod +x /home/anibal/leds_up.sh
edit the file rc.local and add a line that will permanently give all users the ability to change the file on every boot:
Code:
sudo nano /etc/rc.local
specifically, enter this line
Code:
chmod 666 /sys/class/leds/asus\:\:kbd_backlight/brightness
exit 0
(2) Next we need to remap the keyboard so that pressing the function keys will trigger the scripts. To do that we need to get a program called xbindkeys (and its configuration GUI, xbindkeys-config):
Code:
sudo apt-get install xbindkeys xbindkeys-config
create a configuration file (and load a few default settings into it):
Code:
xbindkeys -d > /home/yourname/.xbindkeysrc
Now launch the xbindkeys configuration GUI from a terminal:
Code:
xbindkeys-config
Link:
https://ubuntuforums.org/showthread.php?t=2185305
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment