# Without zenity(1) fallback to either WinForms or no crash dialog

--- Makefile.orig	2015-08-28 13:11:47 UTC
+++ Makefile
@@ -400,12 +400,34 @@ install-man-page: man-page
 install-linux-scripts:
 	@echo "#!/bin/sh" > openra
 	@echo 'cd "$(gameinstalldir)"' >> openra
+	@echo 'ZENITY=`which zenity`' >> openra
+	@echo 'if [ -z "$$ZENITY" ] && (' >> openra
+	@echo '  # from mono/io-layer/processes.c' >> openra
+	@echo '  hash xdg-open 2>/dev/null ||' >> openra
+	@echo '  hash gnome-open 2>/dev/null ||' >> openra
+	@echo '  hash kfmclient 2>/dev/null)' >> openra
+	@echo 'then' >> openra
+ifeq ($(DEBUG), $(filter $(DEBUG),false no n off 0))
+	@echo '  mono OpenRA.exe "$$@"' >> openra
+else
+	@echo '  mono --debug OpenRA.exe "$$@"' >> openra
+endif
+	@echo 'else' >> openra
 ifeq ($(DEBUG), $(filter $(DEBUG),false no n off 0))
 	@echo 'mono OpenRA.Game.exe "$$@"' >> openra
 else
 	@echo 'mono --debug OpenRA.Game.exe "$$@"' >> openra
 endif
+	@echo 'fi' >> openra
 	@echo 'if [ $$? != 0 -a $$? != 1 ]' >> openra
 	@echo 'then' >> openra
-	@echo 'ZENITY=`which zenity` || echo "OpenRA needs zenity installed to display a graphical error dialog. See ~/.openra. for log files."' >> openra
+	@echo '  if [ -z "$$ZENITY" ]' >> openra
+	@echo '  then' >> openra
+	@echo '    echo' >> openra
+	@echo '    echo "OpenRA has encountered a fatal error."' >> openra
+	@echo '    echo "Log Files are available in ~/.openra."' >> openra
+	@echo '    echo' >> openra
+	@echo '    echo "See https://github.com/OpenRA/OpenRA/wiki/FAQ"' >> openra
+	@echo '    exit 1' >> openra
+	@echo '  fi' >> openra
 	@echo '$$ZENITY --question --title "OpenRA" --text "OpenRA has encountered a fatal error.\nLog Files are available in ~/.openra." --ok-label "Quit" --cancel-label "View FAQ" || xdg-open https://github.com/OpenRA/OpenRA/wiki/FAQ' >> openra
