DDC/CI
The DDC/CI standard (introduced in 1998!) allows a computer to send commands to external monitors.
For instance, we can programmatically set the brightness of all our monitors:
- install ddcutil:
sudo apt install ddcutil
- create a shortcut associated with a script to switch between bright and dim:
if [ "$(cat /sys/class/backlight/intel_backlight/brightness)" = "960" ]; then
# Set laptop monitor's brightness
echo 57984 | sudo tee /sys/class/backlight/intel_backlight/brightness
# Set external monitors' brightness
sudo ddcutil setvcp 0x10 60
else
echo 960 | sudo tee /sys/class/backlight/intel_backlight/brightness
sudo ddcutil setvcp 0x10 0
fi
0x10
is the code for brightness
. Run sudo ddcutil detect
to list the monitors ddcutil
can work with, and sudo ddcutil getvcp all
to list the features available.
info
Because sudo
is required, the shortcut's command needs to use pkexec
:
pkexec /path/to/switch-brightness.sh
And by the way, here's another script, to switch between light and dark themes:
if [ "$(gsettings get org.gnome.desktop.interface gtk-theme)" = "'Yaru'" ]; then
gsettings set org.gnome.desktop.interface color-scheme "prefer-dark"
gsettings set org.gnome.desktop.interface gtk-theme "Yaru-dark"
else
gsettings set org.gnome.desktop.interface color-scheme "prefer-light"
gsettings set org.gnome.desktop.interface gtk-theme "Yaru"
fi