Sunday, 21 September 2014

Ubuntu: Change your screen brightness on startup

SCREEN BRIGHTNESS SCRIPT




When we start up our Linux machines we sometimes come across situations where our screen brightness is forgotten when shut down.  In this very short tutorial I will show you a way to adjust the brightness to your liking on every start up by utilising the rc.local script in the /etc/ folder.

Follow these instructions step by step.


Requirements:

  1. A text editor (leafpad, gedit, jed, or something similar)* I will assume from here on in that you installed leafpad.
  2. A compatible video card for adjusting brightness.
Instructions:

  1. open the rc.local file by doing this. Open a terminal and type sudo leafpad /etc/rc.local
  2. copy and paste text below into the rc.local file
  3. please not the line which says echo 35 > ....... This is basically echoing the output to the hardware to say I want 35% screen brightness. Please note that some cards may work on a 0-9 scale for brightness although most cards seem to be on a percent base like mine.

#!/bin/sh -e
    # rc.local
      # This script is executed at the end of each multiuser runlevel.
        # Make sure that the script will "exit 0" on success or any other
          # value on error.
            # In order to enable or disable this script just change the execution
              # bits.
                # By default this script does nothing.
                  #-------------------This changes the screen brightness on startup---------------------
                    echo 35 > /sys/class/backlight/acpi_video0/brightness
                      exit 0





                      * To install a simple editor open you terminal and type this -

                       sudo apt-get update; sudo apt-get install leafpad (type password when promtpted and follow on screen instructions)

                      No comments:

                      Post a Comment