42

I have installed Ubuntu 16.04 TS on my laptop and i have connected my laptop to an external monitor via HDMI cable. I can easily change the brightness of the screen of the laptop 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?

10 Answers 10

51

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
4
  • 2
    It changes back to original value on itself after some time – Peter May 11 '20 at 3:53
  • 1
    @PetroCliff In my case, it was changing back because I'm using redshift. – Gilles Castel May 24 '20 at 9:47
  • 1
    It gets reverted back to original after seconds for me even though I turn off redshift. – Charith Jayasanka Jul 4 '20 at 19:03
  • bonus fact you can go higher than 1 – Emad Sep 16 '20 at 22:06
22

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 tool
  • gksudo gddccontrol or pkexec 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).

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

3
  • 2
    Wow, this changed my life – lleaff Jun 20 '20 at 9:17
  • ddcutil and ddcui were an instant love for me. Thank you. – dimitarvp Jul 15 '20 at 20:20
  • There is even a Gnome extension to control brightness with ddcutil : extensions.gnome.org/extension/2645/… – Max Sep 2 '20 at 9:28
15

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

sudo add-apt-repository ppa:apandada1/brightness-controller
sudo apt-get update
sudo apt-get install brightness-controller-simple

Enjoy!

2
  • 3
    Works great on Ubuntu 18.04. Allowed me to dim the external more than is possible through the buttons on the monitor. – Garrett Jul 7 '19 at 21:39
  • 1
    I 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. – Victor Sergienko Jun 27 '20 at 5:46
8

I have finally found a package, which adjust the brightness of secondary external monitor, which is connected with HDMI.

The package is called as Brightness Controller

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.

enter image description here

0
3

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.

2

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.

4
  • 1
    Thank 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. – Ad Infinitum Mar 20 '17 at 14:10
  • Thanks 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 – Taz8du29 Mar 20 '17 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. – Ad Infinitum Mar 22 '17 at 8:04
  • I have found the solution. Please read my answer :) – Ad Infinitum Mar 23 '17 at 18:46
2

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, ie MON="eDP-1-1"
  • Change STEP=5 to your step value, eg STEP=2 is less noticeable

Call the script with:

  • bright Up or bright + to increase brightness by step value
  • bright Down or bright - to decrease brightness by step value
  • bright (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 :)

0

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 ?!

2
  • 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. – hkoosha Nov 22 '19 at 12:31
  • No, I use a basic Intel GPU. Thanks for the info. – Raymond Wachaga Nov 22 '19 at 16:56
0

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

0
0

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.