Last active
January 4, 2018 19:15
-
-
Save bweigel/21de4a43ddee09c1a804c3df474344f3 to your computer and use it in GitHub Desktop.
[LINUX] Change display brightness of all connected screens
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 | |
BRIGHTNESS=$1 | |
if [[ $(echo "${BRIGHTNESS} >= 0.2 && ${BRIGHTNESS} <= 1" | bc) = 1 ]]; then | |
for disp in $(xrandr | awk '{print $1,$2}' | grep -P '(?<!dis)connected' | awk '{print $1}'); do | |
echo "Setting brightness in display ${disp} to ${BRIGHTNESS}..." | |
xrandr --output $disp --brightness ${BRIGHTNESS} | |
done | |
else | |
echo "A brightness of ${BRIGHTNESS} may be not such a good idea..." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment