Home / Computer / Solve Brightness problem on linux.

Solve Brightness problem on linux.

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.

 

Linux

 

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:

 

  1.       #!/bin/bash
  2.  
  3.       myBrightness=5;
  4.       currentBrightness=`cat /sys/class/backlight/acpi_video0/brightness`;
  5.       count=$(( $currentBrightness - $myBrightness )) ;
  6.       while [ $count -gt 0 ]
  7.       do
  8.            xdotool key XF86MonBrightnessDown
  9.            let  count=$(($count-1));
  10.       done
For minimum brightness:
  1.       #!/bin/bash
  2.  
  3.       myBrightness=5;
  4.       currentBrightness=`cat /sys/class/backlight/acpi_video0/brightness`;
  5.       count=$(( $currentBrightness + $myBrightness )) ;
  6.       while [ $count -gt 0 ]
  7.       do
  8.            xdotool key XF86MonBrightnessUp
  9.            let  count=$(($count-1));
  10.       done
Save this as brightness.shThen make this file to be an executable, by running chmod +x brightness.sh

Finally open the “Startup Applications” click Add and add the following

Startup Applications Preferences_001

       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.

About MD Maruf Billah

Co-Founder and CEO at IT Segment. Studying Computers and Information at Cairo University, Cairo, Egypt.

Check Also

Play Youtube mix in the background on your smartphone

Youtube is smart enough to track that you are actively watching the video or not. ...

Leave a Reply

Your email address will not be published. Required fields are marked *


*

Powered by themekiller.com anime4online.com animextoon.com apk4phone.com