anibalardid
2/14/2020 - 8:52 PM

brightnes keyboard backlight in ubuntu

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