Sunday, October 19, 2008

Towards easier suspend for my PC

I have several PCs at home (Debin Sid). It uses a lot of power. I fear the elctric bill, but I like my PCs to boot fast...

Suspend (suspend to ram) to the rescue!!! ^_^

That is, when it works. But fixing things is already discussed elsewhere. In my case it meant not using the forcedeth Ethernet card on the mother board, but a an oldish PCI 3com instead (although I'd still like to be able to WoL so I might change the 3com for another one).

But I digress. What I've done so far has been to:


  1. Convince pm-tools that yes, it is OK to force s2ram.


  2. Coax GDM to use s2ram -f


  3. Get into every account I have at home and set power management preferences to suspend after 1 hour of inactivity and to suspend on the power button.


  4. Modify the ACPI power button script to suspend instead of powering down. ACPI calls this script to make KDE and/or GNOME aware of the power button action or to shutdown by default otherwise



In short, I wanted to make it really easy to suspend instead of powering down.

For 1) I edited some file in /etc... Unfortunately I had to try so many things I do not remember what I did to successfully make suspend to work, even tough s2ram complains the machines are unknown.

For 2) one I edited /etc/gdm/gdm.conf and added under [daemon]


SuspendCommand=/usr/sbin/s2ram -f


For 3) I just logged into every account (I am root afer all) and changed the power settings for KDE and gnome. I am sure there is a way to change the default. I just got lazy. After fixing everything else.

For 4) I edited /etc/acpi/powerbtn.sh to to s2ram -f instead of the usual shutdown:


# If all else failed, just initiate a plain shutdown.
#/sbin/shutdown -h now "Power button pressed"

# regelatwork: canged to sleep instead of shutdown
/usr/sbin/s2ram -f


This is still not good enough, though. It is still too easy to shutdown from inside a session. It'd be nice to have a simple way to do a logout+suspend instead. Better still for that to be the default logout option and for shutdown to ask something like "are you sure you do not want to logout and suspend instead?"

Also, it is too easy to Shutdown from GDM (it is the default Action). I'd like a similar warning message along with suspend as the default.

Pehaps I'll have to bite the bullet, get my hands dirty and code some scripts and modify some Gnome/KDM code to have things my way.

No comments: