Tag Archives: dbus

14|01|11

Suspend via DBus

My new keyboard did not have a Suspend key that MATE automatically recognizes so I wanted to add a custom keyboard shortcut to bring my computer to sleep. I know the “pm-suspend” command-line utility but unfortunately it requires super-user privileges and is not suitable to be used from a shortcut. Fortunately DBus can be used for this purpose.

Bringing the system to standby is as simple as running the following command, either from a terminal or a keyboard shortcut in your Desktop Environment of choice:

user@host ~ $ dbus-send --system --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend

That’s it!