Skip to content

Instantly share code, notes, and snippets.

@ravikiranj
Last active May 14, 2018 18:34
Show Gist options
  • Save ravikiranj/6034162 to your computer and use it in GitHub Desktop.
Save ravikiranj/6034162 to your computer and use it in GitHub Desktop.
brightness command line tool using xrandr
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
}
@kayode-adechinan
Copy link

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment