How to Enable Screen Brightness Function Key Combinations (Zorin 15.3)

This tutorial is for those using Zorin 15.3 and do not have control of screen brightness by way of the function key shortcuts. It uses the acpi service to recognize events and shell scripts to perform commands you would use in the terminal. Zorin 16 should solve this in newer laptops.

You may have to use sudo if it won't allow you to create or edit the following. Just add sudo before the commands below if you get a permission denied error.

Open your terminal and go to acpi dir:

cd /etc/acpi

type:

touch brightness-up.sh

and:

touch brightness-down.sh

We will populate these in a minute. Now go into events folder:

cd events

create two documents here:

touch brightness-down

touch brightness-up

Now we need to figure out what your system is calling those function shortcuts. In your terminal, still, type:

acpi_listen

You will get a blank screen (no cursor or prompt), do not push anything except the fn key and the respective down f# key and up f# key.
Now press ctrl + c to exit listen.

example output:
video/brightnessdown BRTDN 00000087 00000000
video/brightnessup BRTUP 00000086 00000000

What you are interested in is the identifier after video/brightnessdown and ...up respectively. The letters and numbers will need to be selected, including spaces, to be copied into your events files.

The two values, though they look the same are unique. Next, we'll edit the down event you had created.

gedit brightness-down

Inside the window, copy in the following:

# /etc/acpi/events/brightness-down
# This is called when the user presses the key brightness
# down button and calls /etc/acpi/brightness-down.sh for
# further processing.

event=hotkey paste-hotkey-id-here
action=/etc/acpi/brightness-down.sh

To copy from terminal press ctrl + shift + c after making selection (the top value...we did down first) and in text editor paste at paste-hotkey-id-here. Save the file and close. Open brightness-up:

gedit brightness-up

Copy in the following:

# /etc/acpi/events/brightness-up
# This is called when the user presses the key brightness
# up button and calls /etc/acpi/brightness-up.sh for
# further processing.

event=hotkey paste-hotkey-id-here
action=/etc/acpi/brightness-up.sh

Again, select the bottom value in terminal, ctrl + shift + c and in text editor paste at paste-hotkey-id-here. Save the file and close. Now we'll take care of those shell scripts. Go back to the acpi directory:

cd ..

And open the brightness-down.sh:

gedit brightness-down.sh

Paste in the following:

brlevel=xrandr --current --verbose | grep Brightness | awk '{print $2}'
add=0.1
machinename=echo xrandr | grep " connected" | cut -f1 -d " "
newbrlevel=echo $brlevel $add | awk '{print $1 - $2}'
if [ "$newbrlevel" = "-0.1" ]
then
newbrlevel=echo 0.0
fi
xrandr --output $machinename --brightness $newbrlevel

Save and close it. Open brightness-up.sh:

gedit brightness-up.sh

Paste in the following:

brlevel=xrandr --current --verbose | grep Brightness | awk '{print $2}'
add=0.1
machinename=echo xrandr | grep " connected" | cut -f1 -d " "
newbrlevel=echo $brlevel $add | awk '{print $1 + $2}'
if [ "$newbrlevel" = "1.1" ]
then
newbrlevel=echo 1.0
fi
xrandr --output $machinename --brightness $newbrlevel

Save and close it.
Now reboot computer or use:

service acpid restart

I would recommend a reboot though.

Test that the brightness function combination work, both up and down. Enjoy.
Please let us know if this helped you.

2 Likes