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?
1 Answer
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...
-
Clever. Changing
gnome-session-quit
tognome-session-quit --no-prompt
will eliminate the logout prompt, if that's desired. Aug 11, 2012 at 18:05