Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm creating my own fake Chromium OS session in Ubuntu 12.04. However I don't really know how to make it so that when I close Chromium, it automatically logs out on it's own. Has anyone got any suggestions?

share|improve this question
up vote 3 down vote accepted

Just add this script to your startup programs (Run simple bash script to start applications at login), only for that specific session:

while true; do
   if ! pidof chromium-browser ; then
      gnome-session-quit --no-prompt
   sleep 1;

it will check if chromium is running every second, and, if it is not, then it logs you out...

If you want to prompt before logout (to ask you first), then remove the --no-prompt argument...

Also be careful this script to run after chromium-browser (it may need a timeout before the while loop so as to let the chromium-browser start (with the sleep command)), otherwise it will log you out immediately...

share|improve this answer
Clever. Changing gnome-session-quit to gnome-session-quit --no-prompt will eliminate the logout prompt, if that's desired. – John S Gruber Aug 11 '12 at 18:05
Thanks! I also added something. – hakermania Aug 11 '12 at 19:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.