From c6c0449105c42313aac33e2dd619187a6d1cec8d Mon Sep 17 00:00:00 2001
From: uzlonewolf <github_com@hacker-nin.com>
Date: Sun, 27 Aug 2017 03:09:39 -0700
Subject: [PATCH] Don't try to display the GUI when running in textmode (#387)

* Don't try to display the GUI when running in textmode

* Updated textmode fix to always run the GUI under Windows
---
 client/proxmark3.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/client/proxmark3.c b/client/proxmark3.c
index fa389dd1..956eb6a8 100644
--- a/client/proxmark3.c
+++ b/client/proxmark3.c
@@ -274,8 +274,22 @@ int main(int argc, char* argv[]) {
 	pthread_mutex_init(&print_lock, NULL);
 
 #ifdef HAVE_GUI
+#ifdef _WIN32
 	InitGraphics(argc, argv, script_cmds_file, usb_present);
 	MainGraphics();
+#else
+	char* display = getenv("DISPLAY");
+
+	if (display && strlen(display) > 1)
+	{
+		InitGraphics(argc, argv, script_cmds_file, usb_present);
+		MainGraphics();
+	}
+	else
+	{
+		main_loop(script_cmds_file, usb_present);
+	}
+#endif
 #else
 	main_loop(script_cmds_file, usb_present);
 #endif	
-- 
2.39.5