Hi everyone,
I am trying to enable brightness adjustment on my laptop. There are currently two keys (Fn+F5/F6) that should decrease/increase screen brightness but do not work out-of-the-box.
I am able to manually edit the screen brightness by issuing the command:
Code:
echo -n [0-8] > /sys/class/backlight/acpi_video0/brightness
Where 0-8 corresponds to the desired screen brightness.
I wanted to link this to xbindkeysrc with the use of bash scripts and did the following:
1) placed the following two files in my home directory (chmod 755)
.BrightDown.sh
Code:
#!/bin/bash
brightness_file=/sys/class/backlight/acpi_video0/brightness
brightness=$(< $brightness_file)
if [ $((brightness > 0)) '=' 1 ]
then
brightness=$((brightness - 1))
echo -n $brightness > $brightness_file
fi
.BrightUp.sh
Code:
#!/bin/bash
brightness_file=/sys/class/backlight/acpi_video0/brightness
brightness=$(< $brightness_file)
if [ $((brightness < 8)) '=' 1 ]
then
brightness=$((brightness + 1))
echo -n $brightness > $brightness_file
fi
2) I then added the following to my .xbindkeysrc
Code:
# Decrease Brightness
"/home/roisoleil/.BrightDown.sh"
m:0x0 + c:232
XF86MonBrightnessDown
# Increase Brightness
"/home/roisoleil/.BrightUp.sh"
m:0x0 + c:233
XF86MonBrightnessUp
3) And finally I chmod 646 /sys/devices/virtual/backlight/acpi_video0/brightness
In theory this seems like it should work with me after I restart my wm, but it does not. I also tried running ~/.BrightDown.sh mannually but it did not change the brightness. Any ideas?
EDIT: There was a problem with the .BrightDown.sh file, I have fixed it and this now works (I have updated in this post).