Skip to content

Instantly share code, notes, and snippets.

@joel-wright
Created January 9, 2017 23:27
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save joel-wright/0b514d349faead81947be2dad5e82139 to your computer and use it in GitHub Desktop.
Save joel-wright/0b514d349faead81947be2dad5e82139 to your computer and use it in GitHub Desktop.
AW13 OLED Set Brightness
#!/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
@joel-wright
Copy link
Author

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