Wednesday, May 1, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 334  / 1 Year ago, sun, may 21, 2023, 3:05:13

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?


More From » unity

 Answers
7

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?


[#25994] Monday, May 22, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
earxcept

Total Points: 310
Total Questions: 115
Total Answers: 111

Location: Japan
Member since Sat, Oct 2, 2021
3 Years ago
;