Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like a command I could map to a button or execute within my network.

So far I know the command sudo pm-suspend but I could not make pmi action suspend work on either 12.04 nor 14.04 :

Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Hal was not provided by any .service files

I also used this supposedly cleaner method : dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend

But all these methods have the same apparent result. When I wake my computer, whether on 12.04 or 14.04, some unfinished business glitches the unity launcher and I have to interact with it to "fix it". Glitch

This doesn't happen if I suspend from the unity GUI. Nor does it happen from my laptop where there is a dedicated sleep key. Also there is another clear difference with the GUI method and the above ones, in the clean GUI method (incl my laptop), I have a notification that never appears with the "dirty" methods.

notifyosd

So what function/program/script does unity call when it suspends properly? And how could I map it to a key/event/gesture?

share|improve this question

The exact command to suspend your system as a click from the graphical menu in 14.04 would do is:

dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.Suspend" boolean:true
share|improve this answer

Suspending from the session indicator in the top right corner of the screen can be replicated with the following dbus command.

qdbus com.canonical.Unity  /com/canonical/Unity/Session com.canonical.Unity.Session.Suspend

I have used this dbus service before in other scripts and other answer on askubuntu. For instance, this has been used to determine specific choices user makes to run custom script upon login in this post: How can I run a local command (to run a script) on (just before) log out of a Unity session?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.