I am having problems preventing my laptop, running Ubuntu 14.04, from dimming its screen when on battery power. I have tried everything that is out there on the internet to prevent this happening, but in vain. Most people solved their issue by unchecking the tick box beside "Dim screen to save power" in the "Brightness and lock" settings. I have tried that as well.
So is there any way to do this from the terminal?
Best Answer
You can get its status by using
gsettings
command as following:This will return "true" or "false". So if you want change its value use
set
option instead ofget
and type "true" to enable it or "false" to disable:Now if you don't want to dim the screen when you are on battery power you need some scripting, because that setting doesn't detect or watch the state that if you are on ac-power or on battery mode.
This can be done by using
on_ac_power
command inside a while-loop to checking whether the system is running on AC power as following:Save the script.ex:
dimscreen.sh
and run it by typingsh /path/to/dimscreen.sh
in Terminal.Also you can make it as a
cron
job in yourcrontab
file.dimscreen.sh
)chmod +x /path/to/dimscreen.sh
open the
crontab
file byVISUAL=gedit crontab -e
orEDITOR=gedit crontab -e
Now copy and paste
* * * * * /path/to/dimscreen.sh
at end of it and save the file. This will run your command/script every minute