Best way to suspend computer when inactive?

Any suggestions on ways to set things up so the computer will suspend (e.g., run “sudo pm-suspend”) after a period of inactivity? It seems I could install the power saving module from one of the desktop environments, but that would drag in a lot of the DM’s infrastructure and doesn’t seem in the FVWM spirit. There must be some more concise way to do it!

You can use the function I used in Fvwm-Nightshade]#-----------------------------------------------------------------------

Suspend the machine

DestroyFunc FuncSuspend
AddToFunc FuncSuspend

  • I Test (x systemctl) PipeRead ‘systemctl suspend’
  • I TestRc (!Match) Test (x /usr/sbin/hald) PipeRead ‘dbus-send --system --print-reply --dest=org.freedesktop.Hal
    org.freedesktop.Hal.Device.SystemPowerManagement.Suspend int32:0 1>&2’
  • I TestRc (!Match) Test (x upower) PipeRead ‘dbus-send --print-reply --system --dest=org.freedesktop.UPower
    /org/freedesktop/UPower org.freedesktop.UPower.Suspend 1>&2’[/code]It supports systemd, upower and hald. It depends on your environment whether you need pm-utils (on Gentoo upower-pm-utils).
    There’s a caveat on upower since 0.99 suspend is never supported I guess …

That makes it suspend after a period of inactivity? I was hoping for something that would work automatically …

If you use gnome screensaver perhaps this could work (DBus signal). Or you use the the power management from xscreensaver …

Edit: if you have some programming experience that could help, too.

The power management in xscreensaver doesn’t work, because it only relates to the screen, but it seems to work if you choose one of the text mode screensavers as your sole screensaver and then set the program whose output generates the text to a script that calls sudo pm-suspend.

Thanks for pointing me in that direction!

Hi Jim,

after answering your question the solutions were not so nice at all. And that was nagging me the last days … so I’ve written a small module for that.

See here. Hope this fits your needs better than fiddeling around xscreensaver and friends …

If not … anyway it was an interesting exercise :slight_smile:

– Thomas –

Thanks! It will be a couple days before I can try the new module but it looks like a much better solution. The xscreensaver hack was a bit shaky.



Is there anything obviously wrong with the following?

[code]DestroyFunc FuncSuspend
AddToFunc FuncSuspend

  • I Exec exec sudo /usr/sbin/pm-suspend

DestroyModuleConfig FvwmSleep
*FvwmSleep: Pollinterval 10
*FvwmSleep: Waittime 1
*FvwmSleep: Use FuncSuspend


DestroyFunc StartFunction
AddToFunc StartFunction

  • I Module FvwmSleep


With that setup it doesn’t work. If nothing is obvious I’ll have to put the project aside for now. Other things are pressing, and there are too many oddities with my setup. (I have Debian Wheezy, which is two years old, about to be replaced, and uses fvwm 2.5.30, and a 10 year old Acer Travelmate 2300 laptop that acts oddly any number of ways and can’t be updated to the newer version of Debian because the kernel doesn’t work.)

Hmmm … I think sudo doesn’t work without a terminal. That is one point for FuncSuspend I’ve posted - it doesn’t needs super user rights at all.

Looks good.

Have you installed xprintidle? I have updated my module post some times later. :blush:

:open_mouth: :neutral_face: Yes, these’re very heavy reasons :confused:

That makes it suspend after a period of inactivity? I was hoping for something that would work automatically …