Daily Dairy

Backlight Script runs on startup in Arch Linux.

Screen brightness might be tricky to control. There are many ways to adjust the screen backlight of a monitor or laptop. I installed  xbacklight in my Arch Linux  using :

$ sudo pacman -S xbacklight

In desktop environment it is easy to control brightness using:

$ xbacklight +10
$ xbacklight -10

But these commands not working in console mode.

The brightness of the screen backlight is adjusted by setting the power level of the backlight LEDs or cathodes. The power level can often be controlled using the ACPI kernel module for video. An interface to this module is provided via a folder in the sysfs at /sys/class/backlight.

The name of the folder depends on the graphics card model:

$ ls /sys/class/backlight/

In my case it is:

intel_backlight

In this directory you will find files named  brightness and max_brightness. The brightness can be set by writing a number to brightness. Set it using command :

 $ sudo tee /sys/class/backlight/acpi_video0/brightness <<< 300

tee – read from standard input and write to standard output and files.

The maximum brightness can be found by reading from max_brightness.

Now create a Startup script.

Open directory /etc/local.d/

Create a script with extension .start (with the suffix .start will be executed at boot time, all scripts with suffix .stop at shutdown time)

Now add the code:

#!/bin/sh
sudo tee /sys/class/backlight/intel_backlight/brightness <<< 300

Afterwards mark the script as executable:

$ chmod +x /etc/local.d/brightness.start

To start the local.d scripts at boot time, add its init.d script to the default runlevel:

$ rc-update add local default

Now start the service by making OpenRC check for stopped services in the default runlevel:

$ rc

Now on every startup brightness will automatically set to 300.
Thanks. 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s