PDA

View Full Version : [ubuntu] Single click logout



ypout
October 14th, 2008, 10:15 AM
Is there anyway to logout from a GUI session with a single click of an Icon. i.e I don't want to click the shutdown button and then click logout - I just want to click an icon and have the session logged out.

Any ideas?

Pelham123
October 14th, 2008, 11:08 PM
Well...

I guess if I was doing it I would create a Desktop launcher with the command


sudo shutdown -h now

But then you would still have to enter sudo password. but you could get around this by editing the sudoers file, so the command 'shutdown' was a non-sudo command for a group or user...

Take a look at the 'man' pages for 'shutdown' and 'sudoers' although google might be a better friend for sudoers.

NB: Please be careful and make a backup of the sudoers file before editing please...

JaspSoft
October 15th, 2008, 01:34 AM
My Solution:


echo gnome-session-save --logout > ~/Desktop/LOGOUT.sh
chmod +x ~/Desktop/LOGOUT.sh

Then drag the LOGOUT.sh file from your desktop to the panel... and call it 'logout'.

forger
October 15th, 2008, 01:54 AM
Is there anyway to logout from a GUI session with a single click of an Icon. i.e I don't want to click the shutdown button and then click logout - I just want to click an icon and have the session logged out.

Any ideas?

You can add an application launcher in desktop or in the panel, I suggest the gnome panel since you want a single-click execution of the icon.
Right-click on the panel > add to panel

You have a panel applet "Logout" if you're interested, but it still asks you whether you want to log out or switch user :) However, it logs you out automatically in 60 seconds if you don't reply with logout or switch user

Similar with the shutdown dialog, it shuts down automatically in 60 seconds, you can add a gnome panel application launcher with this:

gnome-session-save --shutdown-dialog

ypout
October 17th, 2008, 10:38 PM
Thanks for your suggestions I'll have a little play and see what works best...

I'll let you know.

Cheers

Update - Here what I've done...

Create a Gnome panel Launcher with the following command


gnome-session-save --kill --silent

This seems to do what I wanted.... Can anyone see any issues with this solution?