Changing the screen brightness for Ubuntu family

lubuntu-launch-header
Changing the screen brightness is the one of the first things you might want to work on. But unfortunately, there is no distinct method to do this after fresh installing because it depends on the system graphic driver.

In order to do this you will need to edit “rc.local” to set:

#1. Name of backlight
#2. Number indicates the brightness

echo #1 > /sys/class/backlight/#2/brightness

$sudo leafpad /etc/rc.local

For example, launch some text editor, add the line (at line 13), before “exit 0”:

#!/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.
echo 68 > /sys/class/backlight/intel_backlight/brightness
exit 0

To identify the name of a back light, it can be found under “/sys/class/backlight/”

$ ll /sys/class/backlight/

Example of output:

total 0
drwxr-xr-x  2 root root 0 Jan 18 16:48 ./
drwxr-xr-x 62 root root 0 Jan 18 16:48 ../
lrwxrwxrwx  1 root root 0 Jan 18 16:48 intel_backlight -> ../../devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight/

In this case, the name of backlight is “intel_backlight”


To identify the number of brightness:
You need to identify the name of backlight, let’s say the name is “pizza”.
To find the current brightness: “cat /sys/class/backlight/pizza/brightness”
To find the maximum brightness: “cat /sys/class/backlight/pizza/max_brightness”

Example: the backlight name is “intel_backlight

$ cat /sys/class/backlight/intel_backlight/brightness
68
$ cat /sys/class/backlight/intel_backlight/max_brightness
255

In this examples, the current brightness is 68 and the maximum is 255.


Example to set the screen brightness as 68 as system start, the name of the backlight is “intel_backlight”

echo 68 > /sys/class/backlight/intel_backlight/brightness

Creating a brightness controller at desktop:

$sudo add-apt-repository ppa:indicator-brightness/ppa
$sudo apt-get update
$sudo apt-get install indicator-brightness

Restart the system, then you will see the controller.
brightness_controller1
Please do not set the brightness as 0, the entire screen will be black and there will be nothing you can do 🙂

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.