29

I have a thinkpad (x301) with an external monitor connected via a DisplayPort to HDMI cable. I can control the brightness of the laptop monitor using the keys on the laptop, but I can't work out how to control the brightness of the external monitor.

$ ls /sys/class/backlight/*/brightness
/sys/class/backlight/acpi_video0/brightness
/sys/class/backlight/intel_backlight/brightness
$ cat /sys/class/backlight/acpi_video0/brightness
11
$ cat /sys/class/backlight/acpi_video0/max_brightness
15
$ cat /sys/class/backlight/intel_backlight/brightness
501804
$ cat /sys/class/backlight/intel_backlight/max_brightness
2414340

I can write values into the above and both intel_backlight and acpi_video0 changes the brightness of the laptop monitor.

Does the above mean that there is no way to change the brightness of the external monitor (other than the OSD)?

Hamish Downer
  • 19,181

6 Answers6

31

You can do this from the command line (and thus do it automatically each evening via cron) using xrandr as described at How to change LCD brightness from command line (or via script)?

E.g.

xrandr --output HDMI1 --brightness 0.5

This doesn't change the backlight or affect power usage, it just adjusts the gamma value in software. I've heard that Brightness Controller uses xrandr under its GUI skin.

Use xrandr --listactivemonitors to get the correct monitor if not you'll probably get xrandr: Need crtc to set gamma on..

ddccontrol was in Lucid 10.04 and seems to have worked well, but was orphaned by Debian due to lack of interest and hasn't been picked up by anyone since.

Update ddccontrol is back in xenial. See

Jan
  • 1,193
  • 11
  • 11
nealmcb
  • 3,647
  • Is there a way to tie the brightness levels of each monitor together? So if I change the brightness level on my primary screen, the secondary moves to match it? – Breedly Jan 14 '16 at 14:05
  • @Breedly I don't know. Click on "Ask Question" to ask a new question. – nealmcb Jan 14 '16 at 21:56
  • 2
    xrandr only seemed to work for me for about 2 seconds then went back to normal. ddccontrol is the way to go though, actually controls the backlight, and works well. It is back in ubuntu now, xenial and yakkety. – Gringo Suave Oct 17 '16 at 21:15
  • Thank you, you just saved my eyes – Catto Jun 14 '23 at 14:27
10

Install Brightness Controller from the following PPA.

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

Screenshot 1

Now you can adjust the brightness using the slider.

Archisman Panigrahi
  • 28,338
  • 18
  • 105
  • 212
  • This is not in the normal repos, but is in the software center at least for 12.04. It does not change the backlight brighness, but does change the overall brightness, though I'm not sure how. It says it uses a proprietary license, but also says it is "gpl-3". Very odd. And I'd like a command-line interface that I can script to gradually lower brightness in the evening. But I'm still glad to have it - thanks! – nealmcb Apr 28 '14 at 20:30
  • 1
    It's written in Python and uses xrandr. We don't know how to package it for Ubuntu so we submitted it under propritary license (so that reviwers will package it). Source is available at github. https://github.com/lordamit/Brightness/tree/master – Archisman Panigrahi Apr 29 '14 at 07:07
  • 1
    You can control brightness with xrandr via command line like http://askubuntu.com/a/457281/124466. That's what Brightness Controller does in the backend. – Archisman Panigrahi Apr 29 '14 at 07:13
3

Here is the latest information for the brightness controller. There are 2 versions available. Version 1 aka simple version allows support for up to 4 monitors and maintains the classic sliders. Version 2 allows for more specialized control as well as multiple monitors.

You can check them both out here Brightness Controller

For faster install use the PPA

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

Then for Version 1

sudo apt-get install brightness-controller-simple

Brightness Controller Simple

Or for Version 2

sudo apt-get install brightness-controller

Brightness Controller

Enjoy!

2

Using xrandr and few lines of bash script, it is possible to control multiple/all monitors at once for convenience

( I use it for 3 monitors + notebook screen at once )

#!/bin/bash
# brightness.sh - script to set multiple monitor brightness
# Author: Nariman Huseynov

set brightness level from user input & reset if no args provided

if [ -z "$1" ] then echo 'Default brightness 100%' LEVEL=1 else echo "Setting brightness level to" $1 LEVEL=$1 fi

get list of screens,trim noise and remove first line (count)

MONITORS=$(xrandr --listactivemonitors | tail -n +2 | awk '{print $NF}');

change brightness level per monitor at a time

for each in $MONITORS; do xrandr --output $each --brightness $LEVEL; done

For permanent use:

  • add permission to execute:

    $ chmod +x brightness.sh

  • move to bin directory (/usr/local/bin in my case)

    $ sudo mv brightness.sh /usr/local/bin/brightness

  • execute to set brightness level 50% (night mode)

    $ brightness 0.5

  • to reset to 100% brightness

    $ brightness

PS if you don't want error checking and want just few lines, shorter version will do:

# get list of screens,trim noise and remove first line (count)
MONITORS=$(xrandr --listactivemonitors | tail -n +2 | awk '{print $NF}');

change brightness level per monitor at a time

for each in $MONITORS; do xrandr --output $each --brightness $LEVEL; done

2

ADditional info: I'm using CRT monitor. – Neilvert Noval Mar 11 '11 at 17:06It seems that it is not possible to control external monitors using the /sys/class/backlight. But there exists an application called ddccontrol which can control the brightness of your external monitor.

Instructions on how to use the command line interface are available here.

Basically you need to probe for available monitors and controls using ddccontrol -p and look for the address of the control you want in the output and then set the value using ddccontrol -p -r 0x10 -w 70.

tongpu
  • 11,929
0

I suggest to use a simple bash script to adjust the brighness of you monitor up or down a single step

Copy bash script below to a file (the name is not important, as long as the name is not similar to other terminal commends). I call it brightness_ext

Then mark it executable with chmod a+x brightness_ext

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 ]] && MathBright="$Left"00 # 1.0 becomes "100" [[ "${#Right}" -eq 1 ]] && Right="$Right"0 # 0.5 becomes "50" MathBright=$(( MathBright + Right )) [[ "$Right" == 050 ]] && MathBright=5 # if we wanna decrease below 10% [[ "$CurrBright" == 0.0 ]] && MathBright=5 # we can't go below 0, cause it is negative then

[[ "$1" == "Up" || "$1" == "+" ]] && MathBright=$(( MathBright + STEP )) [[ "$1" == "Down" || "$1" == "-" ]] && MathBright=$(( MathBright - STEP )) [[ "$MathBright" -gt 100 ]] && MathBright=100 # Can't go over 1.00

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}" [[ "$MathBright" == 5000 ]] && CurrBright=.05 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

Usage

brightness_ext + to increase brightness; brightness_ext - to decrease, fairly simple

Also i suggest you to create shortcuts for those commands, as they are much more convenient to use. Personally I made brightness shortcuts for my both monitors.

Max
  • 1