I have installed Ubuntu 16.04 LTS on my laptop and connected it to an external monitor via an HDMI cable. I can easily change the brightness of the laptop screen but that does not affect the brightness of the external monitor. Is there any way to change the brightness of the external monitor as well?
-
You can use Deepin or Lubuntu that has this native controll, I already use many distros and that 2 is very good in performance.– Hoiama RodriguesJun 2, 2023 at 19:45
-
You can use Deepin or Lubuntu that has this native controll, I already use many distros and that 2 is very good in performance.– Hoiama RodriguesJun 2, 2023 at 19:45
14 Answers
It's very easy to do via the command line. First, type the following command in terminal to identify your screens:
xrandr -q | grep " connected"
and you'll get something like this:
LVDS1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 194mm
VGA1 connected primary 1366x768+1366+48 (normal left inverted right x axis y axis) 413mm x 234mm
LVDS1 is related to laptop's built-in display. I am using an external monitor (VGA1 in this case). If you want to reduce the brightness of external screen, you just type this, for example:
xrandr --output VGA1 --brightness 0.63
-
3
-
1@PetroCliff In my case, it was changing back because I'm using redshift. May 24, 2020 at 9:47
-
2It gets reverted back to original after seconds for me even though I turn off redshift. Jul 4, 2020 at 19:03
-
3It worked perfect for me. It would be nice to be able to tie this command to the keys to change the brightness in my laptop. Mar 11, 2021 at 15:15
-
4I'm pretty sure this does not dim the screen's backlight. Instead, it reduces the brightness of every pixel. So you lose contrast and waste more power. Nov 19, 2022 at 6:20
Hardware control solution (no software dimming)
By now there are 2 softwares to do hardware dimming:
ddccontrol
(CLI and an GUI)ddcutil
(CLI and an GUI)ddcci-backlight
(driver to be picked up by GNOME and others)
Tool 1: ddccontrol
ddccontrol
(note the double cc
) is a tool to control the settings of many monitors in exactly the same way their on-screen display / hardware buttons control them.
It is available in Ubuntu (man page) via apt install ddccontrol
.
gddccontrol
is a graphical user interface for it: apt install gddccontrol
Both need to be run as root:
sudo ddccontrol
for the command line toolgksudo gddccontrol
orpkexec gddccontrol
for the GUI tool.
(Based on @Ad Infinitum
's comment in @Taz8du29
's comment (but note and extra c
in the name.)
Tool 2: ddcutil
/ ddcui
An alternative to ddccontrol
, made at a time when ddccontrol
was rather unmaintained.
It is available in Ubuntu (man page) via apt install ddcutil
.
You can run them as root
or install the i2c-tools
and add your user to the group i2c
to do it without root (explanation).
It also has a GUI called ddcui
(screenshot here).
In case you want to reduce the brightness past the lowest level allowed on monitor's OSD or ddcutil getvcp 10
, you may try to uniformly reduce RGB levels with ddcutil getvcp 16/18/1A
.
Tool 3: ddcci-backlight
driver
This ddcci driver integrates all ddcci-capable monitors into sysfs, including /sys/class/backlight/
.
Because i.e. GNOME will use that interface to set the brightness, you can set the brightness without an additional UI, or the terminal.
It is available on Ubuntu: apt install ddcci-dkms
-
17
-
3
-
2There is even a Gnome extension to control brightness with ddcutil : extensions.gnome.org/extension/2645/…– MaxSep 2, 2020 at 9:28
-
1Had 2 monitors connected through HDMI and DVI. GUI said "The current monitor is in the database but does not "supports" DDC/CI". well that was fun... Jul 29, 2021 at 20:32
-
The brightness controller mentioned before is now version 2. The original simple version is available using the following steps with support for up to 4 monitors. Tested working without issue on Ubuntu 14.04 and 16.04.
sudo add-apt-repository ppa:apandada1/brightness-controller
sudo apt-get update
sudo apt-get install brightness-controller-simple
Enjoy!
-
4Works great on Ubuntu 18.04. Allowed me to dim the external more than is possible through the buttons on the monitor.– GarrettJul 7, 2019 at 21:39
-
3I noticed that the monitor's built-in menu is still bright. This may mean that the software doesn't really emit HDMI signals, but draws a gray rectangle on top of the screen contents. Jun 27, 2020 at 5:46
-
1Unfortunately doesn't work at all with the "Night Light". They are conflicting.– gnericOct 22, 2021 at 20:09
I have finally found a package, which adjust the brightness of secondary external monitor, which is connected with HDMI.
The package is called Brightness Controller (version 2 with newer interface)
In order to install it, first add the PPA repository to your system and update your package list:
sudo add-apt-repository ppa:apandada1/brightness-controller
sudo apt update
You can then install the package as usual using apt
:
sudo apt install brightness-controller
After it is installed, primary is the first screen and the secondary is the external monitor.
If possible, you should set the brightness using the hardware.
In addition to nh2's answer, there is a ddcci driver that makes the hardware brightness of ddcci-supporting-monitors availabile via the /sys/class/backlight/
interface.
It can be installed by:
sudo apt install ddcci-dkms
That way the brightness control of gnome can set the brightness of external monitors as well.
Rather than plugging in a brightness level for xrandr
you can use this bash script to adjust the brightness up or down in steps.
Copy bash script below to a file called bright
Then mark it executable with chmod a+x bright
Bash Script
#!/bin/bash
MON="DP-1-1" # Discover monitor name with: xrandr | grep " connected"
STEP=5 # Step Up/Down brightnes by: 5 = ".05", 10 = ".10", etc.
CurrBright=$( xrandr --verbose --current | grep ^"$MON" -A5 | tail -n1 )
CurrBright="${CurrBright##* }" # Get brightness level with decimal place
Left=${CurrBright%%"."*} # Extract left of decimal point
Right=${CurrBright#*"."} # Extract right of decimal point
MathBright="0"
[[ "$Left" != 0 && "$STEP" -lt 10 ]] && STEP=10 # > 1.0, only .1 works
[[ "$Left" != 0 ]] && MathBright="$Left"00 # 1.0 becomes "100"
[[ "${#Right}" -eq 1 ]] && Right="$Right"0 # 0.5 becomes "50"
MathBright=$(( MathBright + Right ))
[[ "$1" == "Up" || "$1" == "+" ]] && MathBright=$(( MathBright + STEP ))
[[ "$1" == "Down" || "$1" == "-" ]] && MathBright=$(( MathBright - STEP ))
[[ "${MathBright:0:1}" == "-" ]] && MathBright=0 # Negative not allowed
[[ "$MathBright" -gt 999 ]] && MathBright=999 # Can't go over 9.99
if [[ "${#MathBright}" -eq 3 ]] ; then
MathBright="$MathBright"000 # Pad with lots of zeros
CurrBright="${MathBright:0:1}.${MathBright:1:2}"
else
MathBright="$MathBright"000 # Pad with lots of zeros
CurrBright=".${MathBright:0:2}"
fi
xrandr --output "$MON" --brightness "$CurrBright" # Set new brightness
# Display current brightness
printf "Monitor $MON "
echo $( xrandr --verbose --current | grep ^"$MON" -A5 | tail -n1 )
- Change
MON="DP-1-1"
to your monitor name, ieMON="eDP-1-1"
- Change
STEP=5
to your step value, egSTEP=2
is less noticeable
Call the script with:
bright Up
orbright +
to increase brightness by step valuebright Down
orbright -
to decrease brightness by step valuebright
(with no parameters) to get the current brightness level
Hopefully the bash / shell commands can easily be googled for education but if any questions don't hesitate to ask :)
Brightness is a hardware thing. You can only adjust it by using the external monitor's buttons and integrated interface.
You can do so on the laptop because this hardware is internally wired to a PCI or I²C bus.
To "dim" your external monitor, you can use a program like f.lux, who will remove some colors (blue, mainly) from the GPU output. The result is that the image will look less "aggressive" for your eyes.
You can also try to hack the monitor, using a PIC or AVR chip to emulate the right keypresses (or more, if you reverse engineer a bit) for brightness change.
-
3Thank you for your answer. After my researches, I have found that there is a software packaga ddcontrol, which makes what I want to achieve. However, with ddcontrol, one can only change the brightness of the monitor when it is wired with I2C (VGA or DVI). In my case, i am looking for something similar for the monitor, which is wired with HDMI. Mar 20, 2017 at 14:10
-
1Thanks for making me discover ddcontrol ! Sadly I think that there is no protocol defined over HDMI to handle this kind of commands .... EDIT : My bad, seems tha there is one : elinux.org/CEC_(Consumer_Electronics_Control)_over_HDMI– Taz8du29Mar 20, 2017 at 20:39
-
Consumer Electronics Control is a very interesting topic :) Thank you make me discover it :) I am still looking for a suitable solution to my "problem". No success but I think there is a solution somewhere. Mar 22, 2017 at 8:04
-
There is also the possibility to use extensions to include the hardware brightness control in the system UI. Most of them rely on ddcutil as backend. You can go to https://extensions.gnome.org/ and search for "ddc brightness".
They usually require some configurations, for example, to grant your user the required permissions. Check each extension documentation/repository.
Some extensions are:
If you're using Chrome, try Firefox. It's the strangest thing. My brightness is okay everywhere else on my extended display (downloaded movies, Firefox) but on Chrome the brightness is dull ?!
-
Same issues here. Are you using nvidia / nouveau by any chance? on wayland? one hint: if running chrome on wayland on nouveau, do not take screenshots (ctrl + Print Screen shortcut or whatever else you have changed to, if you did). It'll mess up the chrome badly.– hkooshaNov 22, 2019 at 12:31
-
My problem is the monitor seems to "step down" in brightness after double-display becomes active with Ubuntu 18.04 on an HP15 AMD laptop...
From the "TV" brightness level... and changing the "brightness" with xrandr
only contrast changes.
I can't easily fix it by changing the gamma. It might just be a hardware-dependent problem. I have not had this problem with previous HDMI monitor configurations on this laptop.
So, a warning: even if you use xrandr or xbrightness, you'll find the results are vendor-dependent.
Also gksudo/gksu has been dropped from Ubuntu as of 18.04 https://itsfoss.com/gksu-replacement-ubuntu/
And if you're going to run ddccontrol
, then you'll need to find a page on how to launch it before using it...a task for another day
I'm using Ubuntu and I tried to use
xrandr --output VGA1 --brightness 0.5
But every time I hit the command the brightness of the secondary display reduces for a second and reverts back. Then I found the reason behind it.I was using Redshift and it is periodically overriding all other settings. Simply exit redshift (if you're experiencing the same issue) and try the xrandr command again.
After using the xrandr command you can use Redshift. But make sure redshift is properly exited before using the xrandr command.
I use this script to set the brightness of the second display equal to the brightness of the primary one:
$ same-brightness.sh DP-1 +20
#! /usr/bin/env bash
set -e
# Help
if [[ $# -eq 0 ]] ; then
cat <<EOF
Set the brightness of the specified display equal to the primary display
Usage: $(basename "$0") <output-name> [brightness-offset]
Example: $(basename "$0") DP-1 +20
EOF
exit 255
fi
# Arguments
secondary_display_name="$1"
brightness_offset="${2:-+0}"
# Primary display
primary_display="/sys/class/backlight/intel_backlight"
actual_brightness=$(cat $primary_display/actual_brightness)
max_brightness=$(cat $primary_display/max_brightness)
# Calculate brightness
frac=$(printf %.2f\\n "$(( 100 * $actual_brightness / $max_brightness + $brightness_offset ))e-2")
echo "Setting $secondary_display_name brightness: $frac"
# Set brightness
xrandr --output "$secondary_display_name" --brightness $frac
-
1Nice idea. Is there a way to execute it automatically whenever the main display's brightness changes? Dec 23, 2021 at 20:46
If you don't want to run this long command everytime you want to change brightness then: open bashrc file by running
$ nano ~/.bashrc
bashrc file is a script file that's executed when a user logs in. It contains a series of configurations for the terminal session. Like setting up or enabling: coloring, completion, shell history, command aliases, and more.
At the end of this file write the following code
$ brightness () { xrandr --output HDMI-1 --brightness $1; }
This will create a brightness function with a parameter which will be the value you want to set
To utilize this function in the same session run the following command (or restart the terminal)
$ source ~/.bashrc
To use this function run
$ brightness [value]
Compiling some of the answers here and elsewhere I made an xbindkey script to change main screen and second screen brightness (and other things such as volume) using mouse wheel or other control keys, it may be of some help : https://github.com/mrtgenet/xbindkeys-guile-mouse-altkeys-and-more
Notably, as you might notice, ddcutil setcvp
may be quite slow.
To accelerate you might use --async
option for multithreading and --noverify
option once you are sure what you are doing.
The main slowing issue is the implicit call of ddcutil detect
, so you may want to note the bus number of the screen gave by this command as illustrated below:
Display 1
I2C bus: /dev/i2c-19 <--- HERE
EDID synopsis:
Mfg id: AAA
Model: AAAA P1234
Product code: 12345
Serial number: ABCD123
Binary serial number: 123456789 (0x075bcd15)
Manufacture year: 1917, Week: 42
VCP version: 2.1
Then specifying ddcutil setvcp --async --noverify --bus 19 10 + 10
for example will override the implicit detect
call and speed things up.
Hope this useful :)