In Ubuthu machines such as Thinkpad T520 every-time when we restart the computer the brightness level will be at its maximum and then we need to manually set the brightness to a comfortable level.
To solve this issue here I share a small script I have written.
First install xdotool
sudo apt-get install xdotoolThis will allow you to change the brightness easily from the command line with out admin privileges.
Check whether the brightness is changing with the following command
xdotool key XF86MonBrightnessDown
Now we have to find the file where the brightness value is stored, try doing
cat /sys/class/backlight/acpi_video0/brightnessIf 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. 9
In this example I have used 9 as my brightness level change it according to you.
#!/bin/bash myBrightness=9; currentBrightness=`cat /sys/class/backlight/acpi_video0/brightness`; count=$(( $currentBrightness - $myBrightness )) ; while [ $count -gt 0 ] do xdotool key XF86MonBrightnessDown let count=$(($count-1)); done
Then make this file to be an executable, by running
chmod +x brightness.sh
Finally open the "Startup Applications" click Add and add the following
Name :<appropriate name>
Command:/<path to file from root>/brightness.sh