You can get its status by using gsettings
command as following:
gsettings get org.gnome.settings-daemon.plugins.power idle-dim
This will return "true" or "false". So if you want change its value use set
option instead of get
and type "true" to enable it or "false" to disable:
gsettings set org.gnome.settings-daemon.plugins.power idle-dim true
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:
#!/bin/bash
while true
do
if on_ac_power; then
gsettings set org.gnome.settings-daemon.plugins.power idle-dim true
else
gsettings set org.gnome.settings-daemon.plugins.power idle-dim false
fi
sleep 60 # check the state in each 60 seconds
done
Save the script.ex: dimscreen.sh
and run it by typing sh /path/to/dimscreen.sh
in Terminal.
Also you can make it as a cron
job in your crontab
file.
#!/bin/bash
if on_ac_power; then
gsettings set org.gnome.settings-daemon.plugins.power idle-dim true
else
gsettings set org.gnome.settings-daemon.plugins.power idle-dim false
fi
- Saving the script (example
dimscreen.sh
)
- Make it executable
chmod +x /path/to/dimscreen.sh
open the crontab
file by VISUAL=gedit crontab -e
or EDITOR=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
.---------------- minute (0 - 59)
| .------------- hour (0 - 23)
| | .---------- day of month (1 - 31)
| | | .------- month (1 - 12) OR jan,feb,mar,apr ...
| | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
| | | | |
* * * * * command to be executed
vim
, do:VISUAL=gedit crontab -e
, orEDITOR=gedit crontab -e
. – muru Dec 27 '14 at 09:56