Created
September 14, 2018 10:18
-
-
Save piersy/0a4b690560e6f2dfa86f27e04d36683a to your computer and use it in GitHub Desktop.
Easily set brightness of connected monitors via xrandr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Match 0.x-1 | |
REGEX='^0.+([0-9]+)+$|1' | |
SCRIPT_NAME=`basename "$0"` | |
if ! [[ $1 =~ $REGEX ]] ; then | |
echo "Usage: ${0##*/} <brightness_value_0.x_to_1>" >&2; exit 1 | |
fi | |
OUTPUTS=`xrandr | grep connected | grep "mm$" | awk '{print $1}'` | |
for x in $OUTPUTS; do | |
xrandr --output $x --brightness $1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment