Skip to content

Commit

Permalink
Improvements to cinnamon-launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
clefebvre committed Apr 25, 2013
1 parent 69c0e3d commit 383e70c
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions files/usr/bin/cinnamon-launcher
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ from gi.repository import Gtk

gettext.install("cinnamon", "/usr/share/linuxmint/locale")

def confirm(message):
d = Gtk.MessageDialog(None, 0, Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO)
def confirm_restart():
d = Gtk.MessageDialog(None, 0, Gtk.MessageType.WARNING, Gtk.ButtonsType.YES_NO)
d.set_keep_above(True)
d.set_markup("<span size='large'><b>%s</b></span>" % message)
d.set_markup("<span size='large'><b>%s</b></span>\n\n%s" % (_("Do you want to restart Cinnamon?"), _("Cinnamon just crashed. You are currently running in Fallback Mode.")))
d.show_all()
resp = d.run()
d.destroy()
Expand All @@ -21,12 +21,17 @@ def confirm(message):
if __name__ == "__main__":
cinnamon_pid = os.fork()
if cinnamon_pid == 0:
os.execvp("cinnamon", ("",) + tuple(sys.argv[1:]))
os.execvp("cinnamon", ("cinnamon",) + tuple(sys.argv[1:]))
else:
exit_status = os.waitpid(cinnamon_pid, 0)[1]
if exit_status != 0:
if os.fork() == 0:
os.execvp(FALLBACK_COMMAND, ("",) + FALLBACK_ARGS)
if os.path.exists("/usr/bin/gnome-panel"):
os.system("gnome-panel --replace &")
elif os.path.exists("/usr/bin/tint2"):
os.system("killall tint2")
os.system("tint2 &")
os.execvp(FALLBACK_COMMAND, (FALLBACK_COMMAND,) + FALLBACK_ARGS)
else:
if confirm(_("Cinnamon crashed.\nDo you want to restart it ?")):
os.execvp(sys.argv[0], ("", "--replace"))
if confirm_restart():
os.execvp(sys.argv[0], (sys.argv[0], "--replace"))

0 comments on commit 383e70c

Please sign in to comment.