Add support for respawning Compiz

If you start gnome-shell while Compiz is running, respawn it instead
of Metacity when gnome-shell ends.

http://bugzilla.gnome.org/show_bug.cgi?id=578148
This commit is contained in:
Siegfried Gevatter 2009-04-06 18:41:57 +02:00 committed by Dan Winship
parent 22835b35e7
commit 0857377f82

View File

@ -222,6 +222,7 @@ if options.wide:
options.geometry = "1280x800" options.geometry = "1280x800"
metacity_pid = pidof("metacity") metacity_pid = pidof("metacity")
compiz_pid = pidof("compiz.real") or pidof("compiz")
gnome_panel_pid = pidof("gnome-panel") gnome_panel_pid = pidof("gnome-panel")
# Run in Xephyr if gnome-panel is already running and the user didn't # Run in Xephyr if gnome-panel is already running and the user didn't
@ -229,7 +230,8 @@ gnome_panel_pid = pidof("gnome-panel")
if options.replace: if options.replace:
run_in_xephyr = False run_in_xephyr = False
else: else:
run_in_xephyr = (metacity_pid != None or gnome_panel_pid != None) run_in_xephyr = (metacity_pid != None or compiz_pid != None or
gnome_panel_pid != None)
# Figure out whether or not to use GL_EXT_texture_from_pixmap. By default # Figure out whether or not to use GL_EXT_texture_from_pixmap. By default
# we use it iff we aren't running Xephyr, but we allow the user to # we use it iff we aren't running Xephyr, but we allow the user to
@ -272,12 +274,17 @@ except KeyboardInterrupt, e:
print "Shell killed" print "Shell killed"
finally: finally:
if not run_in_xephyr and (metacity_pid or gnome_panel_pid): if not run_in_xephyr:
# Restart gnome-panel and window manager # Restart gnome-panel and window manager
if options.verbose:
print "Restarting Metacity and Gnome Panel"
if metacity_pid: if metacity_pid:
if options.verbose:
print "Restarting Metacity"
subprocess.Popen(["/usr/bin/metacity"]) subprocess.Popen(["/usr/bin/metacity"])
elif compiz_pid:
if options.verbose:
print "Restarting Compiz"
subprocess.Popen(["/usr/bin/compiz"])
if gnome_panel_pid: if gnome_panel_pid:
if options.verbose:
print "Restarting gnome-panel"
subprocess.Popen(["/usr/bin/gnome-panel"]) subprocess.Popen(["/usr/bin/gnome-panel"])