Skip to content

Instantly share code, notes, and snippets.

@alisinabh
Created April 21, 2017 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alisinabh/9b0508e995431bb32be696663815be39 to your computer and use it in GitHub Desktop.
Save alisinabh/9b0508e995431bb32be696663815be39 to your computer and use it in GitHub Desktop.
X window selective brightness control - using Xrandr and awk
BRIGHTNESS=`xrandr --verbose | grep -i brightness | cut -f2 -d ' ' | head -n1`
NEW_BRIGHTNESS=`awk '{print $1-$2}' <<<"$BRIGHTNESS 0.05"`
echo $NEW_BRIGHTNESS
xrandr --output DVI-I-1 --brightness $NEW_BRIGHTNESS
xrandr --output DVI-I-2 --brightness $NEW_BRIGHTNESS
BRIGHTNESS=`xrandr --verbose | grep -i brightness | cut -f2 -d ' ' | head -n1`
NEW_BRIGHTNESS=`awk '{print $1+$2}' <<<"$BRIGHTNESS 0.05"`
echo $NEW_BRIGHTNESS
xrandr --output DVI-I-1 --brightness $NEW_BRIGHTNESS
xrandr --output DVI-I-2 --brightness $NEW_BRIGHTNESS
xrandr --output DVI-I-1 --brightness 1
xrandr --output DVI-I-2 --brightness 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment