Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

1 Answer 1

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:

#!/bin/bash
while true; do
   if ! pidof chromium-browser ; then
      gnome-session-quit --no-prompt
      exit
   fi
   sleep 1;
done

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

 
discard

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.