Last active
May 14, 2018 18:34
-
-
Save ravikiranj/6034162 to your computer and use it in GitHub Desktop.
brightness command line tool using 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
function brightness(){ | |
if [ $# -gt 0 ]; then | |
# set brightnessValue | |
brightnessValue=$1 | |
# get activeDisplay | |
activeDisplay=`xrandr -q | grep ' connected' | head -n 1 | cut -d ' ' -f1` | |
# change brightness if $activeDisplay is not empty | |
if [ "$activeDisplay" != "" ]; then | |
xrandr --output $activeDisplay --brightness $brightnessValue | |
else | |
echo "Could not determine active display, run 'xrandr --verbose' for detailed info" | |
fi | |
else | |
echo -e "Error!!! Syntax: brightness <value (0.0 to 1.0)>" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks