With a little side of applesauce...

Sunday, April 15, 2007

gnome-power-manager - suspend from the command line

In a not very intuitive manner, you can send your laptop into hibernation by using the following command:

dbus-send --session --dest=org.gnome.PowerManager --type=method_call --print-reply --reply-timeout=2000 /org/gnome/PowerManager org.gnome.PowerManager.Hibernate

To suspend to RAM:

dbus-send --session --dest=org.gnome.PowerManager --type=method_call --print-reply --reply-timeout=2000 /org/gnome/PowerManager org.gnome.PowerManager.Suspend

I would put that in a shell script in /usr/local/bin/mysuspend:

#!/bin/sh

dbus-send --session --dest=org.gnome.PowerManager --type=method_call --print-reply --reply-timeout=2000 /org/gnome/PowerManager org.gnome.PowerManager.Hibernate

Then chmod it to:

chmod 755 /usr/local/bin/mysuspend

You could then run "mysuspend" from anywhere, and execute the same command above... I found this at:
http://live.gnome.org/GnomePowerManager/FAQ#head-ca9ddd6e2954f42fa6fb45b392ece499a6f8ab6f

No comments: