What is the shutdown command?

I want to create a shutdown icon for the launcher in 13.04. In former versions of Ubuntu I used this desktop file and put it in the launcher:

.local/share/applications/indicator-session-shutdown.desktop

[Desktop Entry]
Name=Shut Down
TryExec=/usr/lib/indicator-session/gtk-logout-helper
Exec=/usr/lib/indicator-session/gtk-logout-helper --shutdown
Icon=system-shutdown
Terminal=false
Type=Application
OnlyShowIn=Unity;
Categories=System;
Version=1.0
X-Ubuntu-Gettext-Domain=indicator-session

I wonder if

/usr/lib/indicator-session/gtk-logout-helper --shutdown

is still the correct command in 13.04.

Here is a screenshot with old shutdown dialog:

enter image description here

Here is a screenshot with new shutdown dialog:

enter image description here


Solution 1:

Try:

gnome-session-quit

For more options:

gnome-session-quit --help

According to the manual, the following options are supported:

   --logout
          Prompt the user to confirm logout. This is the default behavior.

   --power-off
          Prompt the user to confirm system power off.

   --reboot
          Prompt the user to confirm system reboot.

   --force
          Ignore any inhibitors.

   --no-prompt
          End the session without user interaction. This only  works  with
          --logout.

Or looking at dbus-monitor, this is the command:

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

Solution 2:

To get that exact dialog, the only way is through dbus, since gnome-sesion-quit only shows the generic four-options dialog. I got this by looking at dbus-monitor. This is the command:

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