XRANDR

Bash: A Simple Script for Changing Display Brightness with XRANDR

I run two external displays on my laptop; the brightness keys on the laptop don't affect them. I could probably find an app or extension for Xubuntu to handle dimming the displays, but since I spend a lot of time on the command line, it's just as easy to dim them from there with the help of XRANDR and a simple Bash script. This post outlines how to set the script up. I'll also cover an optional "night mode" that reduces blue gamma from the display.

If you're on Xubuntu, Ubuntu, or just about any other flavor of Linux, you're probably using the X server to handle your display configurations. That should also mean that you have XRANDR available on the command line. XRANDR can change display configurations in any number of ways, but today I wanna look at it for controlling brightness. Here's the deal, though: I don't wanna have to memorize yet another command line syntax just to dim my monitors. Whichever way XRANDR handles the dimming, I'm gonna move it into a Bash script and alias it so I can adjust brightness on the fly!