1

I know there is already a similar question about this topic. But that question was only about how to get the shutdown dialog in general. I need to get back the countdown of the old shutdown dialog (Ubuntu <= 12.10) which shutdown the system after 60sec.

geobuntu suggested this dbus call in his answer:

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

qdbus indicate that third argument is max_wait which should (in my opinion) set and start the countdown:

~$ qdbus org.gnome.Shell /org/gnome/SessionManager/EndSessionDialog
[...]
method void org.gnome.SessionManager.EndSessionDialog.Open(uint type, uint arg_1, uint max_wait, QList<QDBusObjectPath> inhibitors)

But it doesn't. I already tried various values for type and arg_1 without luck.


EDIT: Actually the countdown is more 'nice to have'. What I really need is that the system WILL shutdown without any extra user action. It should work without sudo (including any no-password sudoers).

I would prefer dbus calls cause I already have a nice list of dbus calls which will shutdown all DE's except Unity >= 13.04


EDIT2: I had a look into Unity source. I don't know C++ but for me it looks like arg1 and timeout_length are not handled in source (can someone with C++ knowledge please confirm this?). Maybe this will be added in later releases.


EDIT3: I reported this as bug #1256703 on Launchpad.

Germar
  • 6,537

2 Answers2

3

There was a great answer from Majal Mirasol about this. He suggested to use

/usr/bin/dbus-send --system --print-reply \
--dest="org.freedesktop.ConsoleKit" \
/org/freedesktop/ConsoleKit/Manager \
org.freedesktop.ConsoleKit.Manager.Stop

This will work perfectly for me.

If you like this solution please send kudos to Majal's answer and not this one.

Germar
  • 6,537
1

Run sudo visudo in the terminal and add the following line:

%user_name ALL=(ALL) NOPASSWD: /sbin/poweroff, /sbin/reboot, /sbin/shutdown

This allows you to run the above three commands, using sudo, however with no password.

So, sudo poweroff will now result in a password less shutdown.

then create an alias by putting the following at the end of ~/.bashrc_aliases by opening it as -

gedit ~/.bash_aliases

and add the following in the last -

alias shutdown='sudo shutdown -h now'

Now lets load the changes to the .bash_aliases file.

source ~/.bash_aliases

Try shutdown . hope it will work.

sourav c.
  • 46,120
Sukupa91
  • 3,067