0

I'd like to make screen brightness lower on low battery. There's no such options in power settings. Alternatively, I may set the system to shut down in such situation, but that's undesired. Is there any kind of script or bash command that I could use to set lower screen brightness on low battery?

  • Which Desktop Environment do you use? – dr_ Jun 20 '19 at 8:05
  • Cinnamon desktop. – Dune Jun 20 '19 at 9:49
0
sudo apt-get install xbacklight

and give this a try

#!/bin/bash

lowBatLevel=25 #battery percent considered low
desiredBrightness=25 #brightness level to lower to ( 0 to 100 )
batLevel=`upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep percentage | awk '{print $2}'  | sed 's/.$//'`
curBrightness=`xbacklight -get`

if    [ $curBrightness -gt $desiredBrightness ]  && [ $batLevel -le $lowBatLevel ]  ; then #change 25 to your desired battery % 
xbacklight -set $desiredBrightness
fi

I'm not on a linux machine so I have not tested, let me know if you have any errors

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.