Skip to content

Simple script to control multiple screen brightness on Linux

Notifications You must be signed in to change notification settings

64J0/linux-screen-brightness

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Linux terminal - Screen brightness changer

When working with multiple monitors, it’s often hard to keep both brightness synced, which is annoying and probably bad for the eyes health (need to check this later).

Some projects that aim to solve the same problem:

With this in mind, I decided to start exploring how to control the screen brightness through terminal on Linux. This repository holds what I found most effective to my case.

Script

#!/bin/bash
set -euo pipefail

# must be a float within 0.0 - 1.0 range
BRIGHTNESS_LEVEL="${1:-1.0}"

function main {
    echo "Using BRIGHTNESS_LEVEL: ${BRIGHTNESS_LEVEL}..."
    
    xrandr --listmonitors |\
        grep -E -o '\s\w+(-1)' |\
        xargs -I '{}' xrandr --output '{}' --brightness "${BRIGHTNESS_LEVEL}"
}

main

About

Simple script to control multiple screen brightness on Linux

Topics

Resources

Stars

Watchers

Forks

Languages