Posted in Just Ask Matt

Linux Backlight Brightness Keyboard Shortcuts

Linux Backlight Brightness Keyboard Shortcuts Posted on April 18, 20244 Comments
Freedom Penguin’s founder & talking head – Matt has over a decade working with Linux desktops, his operating system experience consists of both Windows and Linux operating platforms. In addition to writing articles on Linux and open source technology for Datamation.com and OpenLogic.com/wazi, Matt also once served as a co-host for a popular Linux-centric podcast. Matt has written about various software titles, such as Moodle, Joomla, WordPress, openCRX, Alfresco, Liferay and more. He also has additional Linux experience working with Debian based distributions, openSUSE, CentOS, and Arch Linux.
(Last Updated On: April 17, 2024)

Today Joe H. writes,

Hi there, really enjoy your site. I love using Linux and have tried various distros but still consider myself a newbie. My problem is that when I log on, no matter what OS, I have a dull screen on my laptop and have to adjust the brightness button. Ok no big deal with the likes of Mint, Ubuntu, etc, but with the lesser used distros I can’t find the brightness button, and so stops me using these distros. I am guessing this is the fault of the laptop (Acer). Is there a permanent fix? Can it be done in the bios or in a terminal? Would love to solve this problem but so far cannot find the correct answer, (having tried various wrong ideas). Thanks for any reply, Joe. (Liverpool, England).

Hi Joe! This is a frustration point, as each laptop seems to take a different approach to setting the brightness. Because it sounds like you’re wanting to keep the screen bright as it can go for better visibility. The first approach I will show you is an older technique but will provide you with full brightness upon every reboot.

Full Linux backlight brightness even when idle

The first tip I’d recommend is to go into your power management preferences, make sure your settings for “on AC” and “on battery” are set to not dim display when idle. This is usually a checkbox found for both AC and battery tabs. Also, do the same with the option for “Reduce backlight brightness” in the battery section. To make sure the changes take immediate effect, be sure to restart your computer.

Doing this right away will help the additional tips below to stick and not create new headaches.

Full Linux backlight brightness with GRUB edit

The second tip is my recommended approach for Joe. This will enable the laptop to have full backlight brightness enabled at each boot.

  • Advantage: Full brightness at every boot, even after upgrades to the system.
  • Disadvantage: This brightness technique renders your backlight function keys non-functional. This is reversible by restoring your original grub settings.

1) Open a terminal window. Backup your existing grub bootloader settings. This allows you to restore to the original settings should you decide this approach isn’t a good fit for you.

sudo cp /etc/default/grub /etc/default/grub.bak

2) Edit grub to detect and handle your backlighting better. Remember, this will render your backlight brightness function keys non-functional unless you restore your original grub settings.

sudo nano /etc/default/grub

3) You’re going to look for a section of the file that looks like this:

GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

The section we’re interested in is this one:

 GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

4) We need to change this line’s “____” section to look like this:

GRUB_CMDLINE_LINUX_DEFAULT="quiet acpi_osi=Linux acpi_backlight=vendor splash"

5) Now type Ctrl+X, save when prompted and you’re done.

6) Reboot your laptop. It will likely remain dim at first, but will be bright at the login screen.

Full Linux backlight brightness with a new systemd service file

If editing grub didn’t work, the next step is to try creating a systemd service to set the brightness at the level you want at each boot.

  • Advantage: Full brightness at every boot, even after upgrades to the system.
  • Disadvantage: On some laptops, this may not work at all. It won’t break anything. Rather, this systemd service might fail to work at all.

1) Open a terminal window and change directories to the one described below to create the new service.

cd /lib/systemd/system

2) Still in the terminal with the changed directory, we’re going to create the following file.

sudo nano brightness.service

3) Enter the following into the nano document in your terminal.

[Unit]
Description=Lower default brightness
[Service]
ExecStart=/usr/bin/zsh -c "echo 100 > /sys/class/backlight/intel_backlight/brightness"
[Install]
WantedBy=multi-user.target

4) Save the nano document with a Ctrl+X and save to the name suggested at the prompt.

5) Enable the new service from the terminal with the following:

sudo systemctl enable brightness

6) Reboot and see if it works. This was tested working on Ubuntu 16.10, so your success may vary on other distros or releases of Ubuntu.

Full Linux backlight brightness with an xbacklight alternative

This last backlight brightness tip is my favorite. It’s been tested on multiple distros running the GNOME or MATE desktop. Best part is, it will almost definitely work for any laptop using a modern Linux distro. So why not use xbacklight? Because in some newer distro releases, it’s not working. So we’re going to use a workaround called “bright” instead.

  • Advantage: Full brightness at every boot, even after upgrades to the system.
  • Disadvantage: A specific command will have to add this to your Startup applications. The sudo users settings will need to be adjusted as not to prompt for a password when using the command at the system startup.

1) Download and extract “bright” from Github.

2) From the directory containing the extracted files, copy the “bright” file to a new directory as outlined below using your terminal. If you ran git to download the program, then your source directory may be /home/username instead.

sudo cp ~/Downloads/bright-master/bright /usr/local/bin

3) Test bright to make sure it works with your laptop.

sudo bright 100

Your display’s backlight should be at its brightest. Now let’s reduce the brightness.

sudo bright 50

If you’re seeing backlight brightness changes, this means bright works.

4) The next step is to stop using sudo to run the bright program. To do this, we’ll edit your sudo settings. First you will need to switch to the root user in your terminal window. This will have its own password setup when you first installed your distro.

su

5) Now it’s time to edit the sudo users settings with the following.

visudo

6) From inside your sudo settings, add the following to the bottom of the file. As an aside, the yourusername is YOUR username.

yourusername ALL=NOPASSWD: /usr/local/bin/bright

7) Save the file and then type exit to jump from root back to your regular user. I also like to reboot just to clear everything out.

Mapping new Linux brightness backlight keys for your keyboard

Now that we have the bright settings working, let’s make them work like function keys. Now, you might be tempted to simply remap your existing backlight function keys. I highly recommend NOT doing this as it may simply mess things up on your laptop.

Instead, we’re going to set up two new keys combinations instead. One for brightness up and another for brightness down.

1) From your control panel (some desktop environments called this the control center), click on the keyboard shortcuts.

2) Click on Accessibility, then head down to the Add button and click that.

3) In the name box, Brightness Up. In the command box, “bright 100” without the quotes. Click Apply.

4) Click Brightness Up, then right click Disabled. When new shortcut appears, type Ctrl+1 (number key).

5) Repeat steps 2 through 4, naming the next two entries Brightness Middle (set to bright 50) and Brightness Down (set to bright 30).

After do this and clicking “Close”. You now have a reliable means of changing your Linux laptop’s backlight controls. Even better, you’re able to do this without messing with the default function keys.

How I control backlight brightness on my Linux computer

Now you might be wondering how I run the backlight controls on my computers? Well, I have access to one laptop that has great function key support and doesn’t require anything in this article. However, I also have an old netbook that requires the grub tweak above in order to have a consistent level of brightness for the screen.

The trouble with the grub fix by itself is that the default function keys controlling the brightness keys simply won’t work. This is why I use the “number key mapping” described above in conjunction the “grub tweak” for sustained brightness at each boot. Allow me to break down the benefits:

1) Using backlight brightness with GRUB ensures that my netbook starts up with the brightness turned all the way up on each boot. This saves me from having to do so later, which can be annoying.

2) Adding number key mapping set to turn up or down my brightness provides me with de facto control of my netbook’s display while maintaining a working brightness control environment. Remember, some older laptops and netbooks still need the grub tweak…which renders the default brightness controls unusable. The number mapping for brightness reintroduces this capability and best of all, it should work on any newer Linux distribution.

The end result of combining these two things is fantastic. I’m able to take a broken display experience and turn it into a win by taking control of how my display backlight brightness works thanks to the tips above.

For Windows users out there – food for thought

Even today, I still find myself supporting Windows systems. And today, surprisingly, there are still Windows admins that honestly believe that Windows 10 has better hardware support than today’s modern Linux distros. Some of the more outspoken among them may even attempt to use this article as a shining example of Linux lacking said hardware support. Allow me to pour some cold water on this train of thought.

1) The netbook of mine in question is a unit that came with Windows 7. It’s not officially supported by Windows 10. Despite this, for testing purposes, I tried to install Windows 10 on it because it’s a working portable and still has value in my eyes. With Windows 10 installed, the WiFi chipset, the touchpad and yes…the function keys that control the brightness won’t work.

2) After exhaustive searching, it seems that ASUS deemed the device unworthy of any driver support for Windows 10. This isn’t me pointing a finger at Microsoft, this is me pointing out because of planned obsolescence, oodles of perfectly good computers end up being recycled because companies that make them aren’t in a position to support their drivers for every new Windows release. I can totally respect that. Makes economic sense to me.

3) This is the part when Linux really sets itself apart from other operating systems. Instead of waiting for some random update that will never happen, Linux provides us with the raw materials to make a folding brick into a working notebook again.

Even though the tips above may seem like a lot of work, the same could be said for the generation of people who used to work on their own TVs, radios and changed their own oil in their cars. Linux isn’t for everyone and that’s completely fine with me. But don’t kid yourself, dear reader, into thinking that Linux has less driver support than its proprietary counterparts. In terms of retroactive device compatibility, it blows Windows out of the water and into another time zone. I’d also point out that newer hardware compatibility is rarely more than a few months off with the latest kernel releases. Just something to think about before leaving negative comments regarding hardware support and Linux. This isn’t an opinion, it’s a statement of proven fact.

As for Joe, the person who wrote me asking for advice on addressing this issue. He should find that one of these tips provides him with the results he’s looking for without waiting on a multinational company to fix it for him.

Do you have Linux questions you’d like Matt to help with? Hit the link here and perhaps you too, can Just Ask Matt!

More great Linux goodness!

Matt Hartley
Matt Hartley
Freedom Penguin’s founder & talking head – Matt has over a decade working with Linux desktops, his operating system experience consists of both Windows and Linux operating platforms. In addition to writing articles on Linux and open source technology for Datamation.com and OpenLogic.com/wazi, Matt also once served as a co-host for a popular Linux-centric podcast.

Matt has written about various software titles, such as Moodle, Joomla, WordPress, openCRX, Alfresco, Liferay and more. He also has additional Linux experience working with Debian based distributions, openSUSE, CentOS, and Arch Linux.

4
Leave a Reply

Please Login to comment
2 Comment threads
2 Thread replies
1 Followers
 
Most reacted comment
Hottest comment thread
3 Comment authors
James Van DammeChuckSuperMin Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Chuck
Member
Chuck

Hi Matt,

Could this user also set GRUB_CMDLINE_LINUX_DEFAULT=”acpi_osi=”? It is my understanding that this would cause ACPI to report brightness as a method that can be translated in Linux.

Best regards,

Chuck

SuperMin
Admin
SuperMin

Hi Chuck,

This is basically what we’re doing here:
https://freedompenguin.com/articles/just-ask-matt/linux-backlight-brightness-keyboard-shortcuts/#Full_Linux_backlight_brightness_with_GRUB_edit

GRUB_CMDLINE_LINUX_DEFAULT=”quiet acpi_osi=Linux acpi_backlight=vendor splash”

One could remove the quiet and splash to settle on

GRUB_CMDLINE_LINUX_DEFAULT=”acpi_osi=Linux acpi_backlight=vendor”

But if I am interpreting your point correctly, it sounds like you’re suggesting leaving acpi_osi=(empty)? Wouldn’t hurt to try it, might be an interesting experiment. Have you had success with this method?

Chuck
Member
Chuck

Hi Matt,

Thank you for the response. I had success with this in a Linux Mint Distro, and recently, a fellow Solus user worked through his problem by setting acpi_os=Linux. With that said, it seems like it works differently depending on the hardware that you have on board. I want to thank you for presenting this, as I am a new Linux user. Articles like these really help me understand the underpinnings of the system.

James Van Damme
Member
James Van Damme

I want to be able to adjust my desktop monitor without having to fiddle with the buttons, which are hidden, unlabeled, and are in multiple menus which are a total pain in the ass. I’m running Ubuntu MATE and the Gnome brightness applet installs, but doesn’t work. I tried Redshift and f.lux, but you have to go into the setup file to change the brightness. Finally I installed gddccontrol which shows up as “Monitor settings” under Preferences in the menu. I added it to the panel. I need to type in my password and click a bunch of stuff but… Read more »