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?
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
- 2,138
- 986
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 ddccontrolfor the command line toolgksudo gddccontrolorpkexec gddccontrolfor 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
- 1,831
- 2
- 18
- 19
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!
- 452
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.
- 452
- 1,129
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.
- 133
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=5to your step value, egSTEP=2is less noticeable
Call the script with:
bright Uporbright +to increase brightness by step valuebright Downorbright -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 :)
- 105,762
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.
- 307
- 1
- 7
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:
- 160
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 ?!
- 103
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
- 8,002
- 9
- 37
- 53
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.
- 103
- 7
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
- 701
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]
- 1
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 :)
- 101

