Got second or external monitor connect to your Linux machine? Here’s how to adjust its screen brightness without using physical buttons.
I’ve written a tutorial about changing external monitor brightness for Ubuntu. But it’s really inconvenient to launch application every time when I want to adjust my portable monitor screen brightness.
So I re-write this tutorial by using keyboard shortcut to adjust external monitor brightness. And, it works in most Linux including Ubuntu, Debian, openSUSE, Fedora, Arch, Linux Mint, Manjaro and their based systems.
Step 1: Install ddcutil
First of all, search for and open a terminal window either from start menu or ‘Activities’ overview depends on your system.
When terminal opens, run one of the command below to install the ddcutil tool:
- For Debian, Ubuntu, Linux Mint based systems, run command:
sudo apt install ddcutil
- For Fedora, use command:
sudo dnf install ddcutil
- Arch and its based system can install the tool via command:
sudo pacman -S ddcutil
- And openSUSE can install it via command:
sudo zypper install ddcutil
Step 2: Enable DDC/CI & add user permissions
Most external monitors support DDC/CI protocol. And, it should have this option enabled out-of-the-box! Just in case, you may use monitor’s physical buttons to enable DDC/CI (usually under ‘Others’).
Also, open terminal and run command to add your user to i2c group to avoid permission issue.
sudo gpasswd --add $USER i2c
Step 3: Adjust brightness using Linux command.
Before being able to use keyboard shortcut to adjust screen brightness, first try out the Linux command.
1. First, run command to detect monitors:
The command should output all connected monitors. Here you need to find out the display number (number 1 in the case).
TIP: for the default display 1, you may skip
--display 1in all commands below.
2. Then, run command to find out the feature code for controlling the brightness.
ddcutil --display 1 capabilities | grep Brightness
In terminal output find out the code (number 10 in the case).
3. Now, you can run command to get the current brightness level (change feature code 10, and display number accordingly):
ddcutil --display 1 getvcp 10
4. Finally, either set custom brightness level (80 for example) by running command:
ddcutil --display 1 setvcp 10 80
Or, increase brightness (for example, level 5 up):
ddcutil --display 1 setvcp 10 + 5
Or, decrease brightness (for example, level 5 down):
ddcutil --display 1 setvcp 10 - 5
NOTE: there are space before and after '+', '-' in the code
Step 4: Set keyboard shortcut to increase/decrease brightness
Once you found the correct command for adjusting the monitor brightness. You can now set custom keyboard shortcut to make life easier!
NOTE: This step is for GNOME Desktop only (Default in Ubuntu/Fedora). For other desktop environments, try go to ‘Keyboard’ settings to add custom shortcut.
- First, open ‘Settings‘ from top-right corner system menu.
- When ‘Settings’ opens, navigate to ‘Keyboard‘ in the left. In right, scroll down and click on ‘View and Custom Shortcuts‘
- In pop-up dialog, scroll down and click “Custom Shortcuts” to create a shortcut key to increase brightness:
- Type a name in “Name” section.
- Input command:
ddcutil --display 1 setvcp 10 + 10(change display number 1, feature code 10, and last level up number 10 accordingly)
- Finally set your desired keyboard shortcut.
Also create one for decrease brightness by replacing ‘+’ in command with ‘-‘.
When everything’s done correctly, you can now use keyboard shortcut you just set to adjust the brightness of external monitor!
In my case, the keyboard shortcut and of course the ddcutil command is about 1 seconds delay for me to see the actual change of screen brightness.