Skip to content

Instantly share code, notes, and snippets.

@pfcoperez
Last active February 20, 2020 10:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pfcoperez/5473a21ffd6360d0ddabcd875d3b660d to your computer and use it in GitHub Desktop.
Save pfcoperez/5473a21ffd6360d0ddabcd875d3b660d to your computer and use it in GitHub Desktop.
#!/bin/bash
BLIGHT_PATH=$(sudo find /sys -type d -name intel_backlight)
MAX_BRIGHTNESS=$(cat $BLIGHT_PATH/max_brightness)
while [ 1 ]; do
echo "$MAX_BRIGHTNESS*$(fswebcam --png -1 - | convert - -colorspace gray -format "%[fx:mean]" info:)" | \
bc -l | cut -d '.' -f 1 | \
sudo tee $BLIGHT_PATH/brightness;
sleep 10;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment