## Description: Add support for separate x screens.
## Origin/Author: Alberts Muktupāvels <alberts.muktupavels@gmail.com>
--- gedit/gedit.c.orig
+++ gedit/gedit.c
@@ -50,6 +50,9 @@
 	GeditApp *app;
 	gint status;
 
+	const gchar *display = g_getenv ("DISPLAY");
+	const gchar *application_id = "org.gnome.Gedit";
+
 #ifdef OS_OSX
 	type = GEDIT_TYPE_APP_OSX;
 #else
@@ -57,11 +60,20 @@
 	type = GEDIT_TYPE_APP_WIN32;
 #else
 	type = GEDIT_TYPE_APP_X11;
+
+	if (display != NULL) {
+		int number_display;
+		int number_screen;
+		
+		if (sscanf (display, ":%d.%d", &number_display, &number_screen) == 2) {
+			application_id = g_strdup_printf ("org.gnome.Gedit.Display_%d_%d", number_display, number_screen);
+		}
+	}
 #endif
 #endif
 
 	app = g_object_new (type,
-	                    "application-id", "org.gnome.Gedit",
+	                    "application-id", application_id,
 	                    "flags", G_APPLICATION_HANDLES_COMMAND_LINE,
 	                    NULL);
 
