I asked the same question for Freya but in Loki the situation is different, none of the two dialogues can be triggered with those commands.

gnome-session-quit --power-off used to trigger this dialogue:

enter image description here

while the default dialogue was triggered by the command dbus-send --session --print-reply --dest=com.canonical.Unity /org/gnome/SessionManager/EndSessionDialog org.gnome.SessionManager.EndSessionDialog.Open uint32:2 uint32:0 uint32:0 array:objpath:[].

enter image description here

Asking on the g+ group here, the command dbus-send --system --print-reply --dest=/org/freedesktop/login1 org.freedesktop.login1.power_off was mentioned, but it doesn't work.

What is the command behind the default Loki Shutdown dialogue? I prefer to use a shortcut for that, especially that the shutdown laptop button triggers no dialogue but suspends directly.


Not quite what you wanted, but here was what I was able to find:

Shutdown directly:

dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.PowerOff" boolean:true

Reboot directly:

dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.Reboot" boolean:true

Sleep directly:

dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.Suspend" boolean:true

Theses commands will immediately trigger the action without any confirmation dialogue — it's the hook that the dialog box uses.

The dialog box you're after is known as EndSessionDialog. It's part of Wingpanel's session indicator. Here is where it's built. Here is where the indicator calls it. Here is where the indicator interfaces with dbus. Here is when org.gnome.SessionManager was swapped out for org.freedesktop.login1.

After much gdbus introspection, I surmise that it's going to be similar to the original dbus command with /org/gnome/SessionManager swapped for /org/freedesktop/login1, but I don't speak the language well enough to find the hook. But I emailed the maintainer so we'll see what we hear back.

| improve this answer | |

I just had to go through this myself.. and with the info provided by wolf I was able to piece together the rest of it with a little bit of digging and I will answer your question to him in the comments.

Also to note - this is on the latest Hera version, so mileage may vary with Loki given the age of the post.

How to activate that prompt.


# run wingpanel if it isn't running already

dbus-send --print-reply --dest="org.gnome.Shell" /org/gnome/SessionManager/EndSessionDialog org.gnome.SessionManager.EndSessionDialog.Open uint32:2 uint32:0 uint32:60 array:objpath:/org/gnome/SessionManager/EndSessionDialog

Note: I am using a different DE - mate. Ideally I should kill wingpanel in like 10 seconds or so if there is no activity

How to logoff directly?

This took a lot of different tries, but finally I came up with this. It is important that both run or you will not log back in well.

loginctl kill-session $XDG_SESSION_ID; loginctl terminate-session $XDG_SESSION_ID

As a scripted solution though the above logoff code does not work, you will need to use the wingpanel still and the following for the dialog prompt first

dbus-send --session --type=method_call --print-reply --dest=org.gnome.SessionManager /org/gnome/SessionManager org.gnome.SessionManager.Logout uint32:1
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy