Created
January 9, 2017 23:27
-
-
Save joel-wright/0b514d349faead81947be2dad5e82139 to your computer and use it in GitHub Desktop.
AW13 OLED Set 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/bash | |
sleep 1 | |
if [ -f ~/.brightness ] | |
then | |
read -r br < ~/.brightness | |
bri=`echo "${br} * 100" | bc -l | xargs printf "%.0f\n"` | |
echo $bri | |
if [ ${bri} -gt 100 ] | |
then | |
br=1 | |
fi | |
xrandr --output eDP-1 --brightness "${br}" | |
# 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 "${br}" | |
fi | |
fi |
That sounds like setting the brightness value as a percentage. If you want to run the xrandr command directly, the brightness value must be between 0 and 1 (although if you set it to 0 the screen will turn off completely!).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I tried to run the xrandr command directly into the terminal and it just turned plain white. Couldn't access the screen anymore. Had to reboot. Any idea why could that have happened?