5

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

fossfreedom
  • 171,546
  • 47
  • 376
  • 404
Ralf Hersel
  • 2,783
  • 3
  • 25
  • 30
  • 1
    Does it work or not? You should try to know.. – Lucio Apr 21 '13 at 21:36
  • Yes it works but it shows the 'old' shutdown dialog. I would prefer the 'new' Unity 13.04 shutdown dialog. – Ralf Hersel Apr 25 '13 at 21:35
  • To be more precise, it first shows the old dialog and then the new one. I'd like to call the new dialog immediatelly too avoid unnecessary mouse clicks. – Ralf Hersel Apr 25 '13 at 21:54
  • 1
    Is [this](http://i.imgur.com/o5Ixxvr.png) the dialog that you call *the **old** one*? Could you upload a screenshoot of *the **new** one*? – Lucio Apr 25 '13 at 22:05

2 Answers2

9

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
geoubuntu
  • 101
  • 4
3

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
Jorge Suárez de Lis
  • 2,826
  • 3
  • 21
  • 34