Created
January 9, 2017 23:26
-
-
Save joel-wright/68fc3031cbb3f7cd25db1ed2fe656e60 to your computer and use it in GitHub Desktop.
AW13 OLED Monitor Brightness
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/sh | |
path=/sys/class/backlight/intel_backlight | |
luminance() { | |
read -r level < "$path"/actual_brightness | |
factor=$((max / 100)) | |
ret=`printf '%d\n' "$((level / factor))"` | |
if [ $ret -gt 100 ]; then | |
ret=100 | |
fi | |
printf `echo "$ret / 100" | bc -l` | |
} | |
read -r max < "$path"/max_brightness | |
while inotifywait -e modify "$path"/actual_brightness; do | |
lm=$(luminance) | |
echo -n "${lm}" > ~/.brightness | |
xrandr --output eDP-1 --brightness "${lm}" | |
# If the previous command failed it's because the nvidia | |
# card is active and it reports different display names | |
if [ $? -gt 0 ] | |
then | |
xrandr --output eDP-1-1 --brightness "${lm}" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sadly Xrandr is not supported on Chromium OS ! any alternatives in sight ?