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

4
  • 1
    Does it work or not? You should try to know..
    – Lucio
    Apr 21, 2013 at 21:36
  • Yes it works but it shows the 'old' shutdown dialog. I would prefer the 'new' Unity 13.04 shutdown dialog. Apr 25, 2013 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. Apr 25, 2013 at 21:54
  • 1
    Is this the dialog that you call the old one? Could you upload a screenshoot of the new one?
    – Lucio
    Apr 25, 2013 at 22:05

2 Answers 2

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
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .