[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.

3 Likes

Hello and please excuse me if I'm reviving an old post but it was the most accurate tutorial I've found so far regarding this issue.
Thank you so much for the original post. However, It didn't seem to work for me...
Whenever I run "acpi_listen" in the terminal, nothing happens, when pressing fn and f2, fn and f3 or f2 or f3 alone (f2 and f3 are the function keys that are supossed to manage the screen brightness down and up, respectively) I don't have any output similar to "video/brightnessdown BRTDN 00000087 00000000".

I tried with the command "xev" and pressing ctrl and f2, gives me the following values for this key:

keycode 68 (keysym 0xffbf, F2),

and the folowing ones when pressing ctrl and f3:

keycode 69 (keysym 0xffc0, F3),

I created the files and filled the scripts according to the tutorial in the "events" and "acpi" folders. Initially I pasted 0xffbf as the hotkey value in "brightness-down" file and 0xffc0 as the hotkey value in "brightness-up" file, executed "service acpid restart" and rebooted the laptop and still f2 and f3 were not able to control the screen brightness.

I tried with "keysym 0xffbf" as the hotkey value in "brightness-down" file and "keysym 0xffc0" as the hotkey value in "brightness-up" file, but that neither worked.

I'm almost sure that I'm not mapping my f2 and f3 keys correctly... however, "acpi_listen" doesn't give me any output...

One final observation: when editing the text files ("brightness-down" and "brightness-up") the following warnings appear on the terminal by saving changes:

gedit:530158): Tepl-WARNING **: 00:50:45.019: GVfs metadata is not supported. Fallback to TeplMetadataManager. Either GVfs is not correctly installed or GVfs metadata are not supported on this platform. In the latter case, you should configure Tepl with --disable-gvfs-metadata.

Unfortuntaely, I followed this tutorial exactly and it doesn't work. It's a shame, because it's really well written and easy to follow. But even after a proper reboot the keyboard hotkeys for screen brightness doen't work.

And yes, I know this tutorial isn't teachnically for Zorin 16, but as I don't have screen brightness control on my laptop in Zorin 16, I figured I'd give this a shot.