In Linux machines has some problem with brightness. every-time when we restart the computer the brightness level will be at its maximum or minimum and then we need to manually set the brightness to a comfortable level.
To solve this issue here I share a small script.
First install xdotool
sudo apt-get install xdotool
This will allow you to change the brightness easily from the command line without root privileges.
Check whether the brightness is changing with the following command
xdotool key XF86MonBrightnessUp (For maximizing brightness).
xdotool key XF86MonBrightnessDown (For minimizing brightness).
Now we have to find the file where the brightness value is stored, try doing
cat /sys/class/backlight/acpi_video0/brightness
If you get an integer value then your good to proceed, else you have to find the appropriate file in your system. In that case check in /sys/class/…
Adjust the brightness and find your desired brightness level using the above command E.g: 5
In this example I have used 5 as my brightness level change it according to you.
For Maximum Brightness:
#!/bin/bash
myBrightness=5;
currentBrightness=`
cat
/sys/class/backlight/acpi_video0/brightness
`;
count=$(( $currentBrightness - $myBrightness )) ;
while
[ $count -gt 0 ]
do
xdotool key XF86MonBrightnessDown
let
count=$(($count-1));
done
#!/bin/bash
myBrightness=5;
currentBrightness=`
cat
/sys/class/backlight/acpi_video0/brightness
`;
count=$(( $currentBrightness + $myBrightness )) ;
while
[ $count -gt 0 ]
do
xdotool key XF86MonBrightnessUp
let
count=$(($count-1));
done
Finally open the “Startup Applications” click Add and add the following
Name :<appropriate name>
Command:/<path to file from root>/brightness.sh
Comment:<appropriate comment>
Now reboot your computer and see magic…………
Not forget to leave a comment.