Wednesday, February 26, 2014

Screen dimming using Powernap

Once you've got powernap configured for sleep, it's only a few short steps to enable screen dimming that works in both the console and in X.

To do so, you'll need to use the two-tier powernap action method. Set the first action method (line 22 of /etc/powernap/config) to 0, or powersave. Set the second action (line 109) to 1, for suspend.

Then, head on over to /etc/pm/power.d. This is the directory for scripts that execute when powersave mode is invoked. Create a new file, called brightness, containing the following:

#!/bin/sh
case $1 in
true)
sudo /usr/local/bin/brightness-set 400
;;
false)
        sudo /usr/local/bin/brightness-set 2700
;;
esac 

[ Note: Substitute brightness-set for your favorite brightness CLI command, I use https://github.com/williballenthin/chrubuntu-brightness-controls.]

Once you've configured your ABSENT_SECONDS to your desired screen dimming timeout in powernap, you should be all set.

No comments:

Post a Comment