2nd Monitor - how to change display light

EOS and i3W
xrandr -q | grep ’ connected’ | head -n 2 | cut -d ’ ’ -f1
returns:
eDP1 - laptop
HDMI1 - external Samsung monitor

With F5 and F6 I can change the laptop’s screen brightness.
How do I change the external monitor’s brightness?

The normal way of controlling a monitor is via its physical buttons.

However, you might also find success with https://aur.archlinux.org/packages/gddccontrol

1 Like

Thank you

a while ago I wrote myself a little script to do this

brightness.sh:

#!/bin/sh

EXTERNALMONITOR=$(xrandr | grep DisplayPort | grep 3840 | cut -d " " -f 1)

CURRBRIGHT=$(xrandr --verbose |grep $EXTERNALMONITOR -A 5 | grep -m 1 'Brightness:' | cut -f2- -d:)

if [ "$1" = "more" ] && [ $(echo "$CURRBRIGHT < 1" | bc) -eq 1 ]
then
    xrandr --output $EXTERNALMONITOR --brightness $(echo "$CURRBRIGHT + 0.1" | bc)
elif [ "$1" = "less" ] && [ $(echo "$CURRBRIGHT > 0" | bc) -eq 1 ]
then
    xrandr --output $EXTERNALMONITOR --brightness $(echo "$CURRBRIGHT - 0.1" | bc)
fi

CURRBRIGHT=$(xrandr --verbose |grep $EXTERNALMONITOR -A 5 | grep -m 1 'Brightness:' | cut -f2- -d:)
CURRBRIGHT=$(echo "$CURRBRIGHT * 100" | bc |  cut -f 1 -d . )

I then created keyboard shortcuts Meta+Numpad+ and Meta+Numpad- to call “brightness.sh more” and “brightness.sh less” you should just need to change the EXTERNALMONITOR detection line to get your external monitor and should be fine to use the script.

Hope it works for you.

Don’t know it it works on Wayland but on X11 it should.

1 Like

This is very kind of you.
I am playing with it and just putting this line in the command line

also

and the echo $EXTERNALMONITOR

returns empty line.
Is that correct?

You should first remove the " | grep 3840 " from the command and check again.

If you don’t have your Monitor connected to DisplayPort but HDMI you can replace the “DisplayPort” with “HDMI”

In the end this was the line I needed for my special configuration.
The EXTERNALMONITOR should contain the first string-part of your monitor.

Example for MY setup:

plain xrandr output:

Screen 0: minimum 320 x 200, current 3840 x 1600, maximum 16384 x 16384
eDP connected (normal left inverted right x axis y axis)
   1920x1080     60.03 +
   1680x1050     60.03  
   1280x1024     60.03  
   1440x900      60.03  
   1280x800      60.03  
   1280x720      60.03  
   1024x768      60.03  
   800x600       60.03  
   640x480       60.03  
HDMI-A-0 disconnected (normal left inverted right x axis y axis)
DisplayPort-0 connected primary 3840x1600+0+0 (normal left inverted right x axis y axis) 880mm x 367mm
   3840x1600     59.99*+  30.00  
   2560x1440     59.95  
   2560x1080     60.00    59.94    59.98  
   1920x1200     59.99  
   1920x1080     60.00    50.00    59.94  
   1600x1200     60.00  
   1680x1050     59.99  
   1280x1024     75.02    60.02  
   1440x900      59.99  
   1280x800      59.81  
   1152x864      75.00  
   1280x720      60.00    50.00    59.94  
   1024x768      75.03    60.00  
   800x600       75.00    60.32  
   720x576       50.00  
   720x480       60.00    59.94  
   640x480       75.00    60.00    59.94  
   720x400       70.08  
DisplayPort-1 disconnected (normal left inverted right x axis y axis)

Command from EXTERNALMONITOR should return:

xrandr | grep DisplayPort | grep 3840 | cut -d " " -f 1
DisplayPort-0

So play around with the command until you receive the desired Monitor-String from xrandr. This will be used to set brightness with the other xrandr commands.

This doesn’t affect the backlight, it adjusts the image brightness value (so you can end up with a blown out image rather than a brighter display).

Still useful, but not quite the same thing.

2 Likes

As I did not exceed 100% brightness it worked for me to dim brightness a little bit in the evening.

Optical impression was fine for me. But thanks for the hint :wink:

1 Like

Thank you for taking the time.
I am not confident enough playing around with it.
I thank you for your help.

If I take the output from your inital post this line should work

EXTERNALMONITOR=$(xrandr | grep HDMI1 | cut -d " " -f 1)

I needed some more grepping as I have a DELL 38" Monitor with integrated hub. This has some more “connected” outputs… :wink: