Close gnome session from console

23,892

The following command is an alternative for the gnome-session-quit (logout) which should close the session cleanly (not killing the gdm):

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

(it's one line)

Share:
23,892

Related videos on Youtube

Juan Simón
Author by

Juan Simón

Updated on September 18, 2022

Comments

  • Juan Simón
    Juan Simón over 1 year

    I use Ubuntu 11.10 64 bits with Gnome Shell.
    I have opened a bug because sometimes "Close session" and "Shutdown" buttons doesn't work. gnome-session-quit only works sometimes: bug

    How can I close the session cleanly from console without gnome-session-quit?

  • Juan Simón
    Juan Simón about 12 years
    It works the first time but if I cancel and I try to use it again, it doesn't work. It only shows: method return sender=:1.2 -> dest=:1.6450 reply_serial=2. I think this is related directly with the bug mentioned before.
  • yossile
    yossile about 12 years
    @Simón Probably gnome-session-quit is executing the above dbus command behind the scenes so you are hitting the same bug.
  • Admin
    Admin about 12 years
    well, is it not as clean as "gnome-session-quit"?
  • Dolchio
    Dolchio about 11 years
    This answer doesn't work from a terminal not part of the dbus session. How do you set it up so an unrelated terminal can use another dbus environment?