Re: Detecting GNOME

Federico Mena Quintero wrote:

On Mon, 2005-07-25 at 17:33 +0100, ghee teo wrote:
[1] In JDS, we simply set a atom by the name of "GNOME_SM_DESKTOP"
on the root window for legacy apps to ping that the session is GNOME.
Though this is not as sophiscated as you suggested, but we do document this
as a interface.

I just pulled that trick from what we used to do a long time ago (circa
GNOME 1.2) to detect whether a file manager already was handling clicks
on the root window.  It would work equally well for "am I running
GNOME?".  Wanna cok a patch? :)
  The patch is dead simple [1]. However, its acceptance into gnome-session
may not be that 'simple'. I remember long debates going on here before, sorry
couldn't find the thread. It was rather inconclusive then.

To make this to work, we have to make this a stable interface which implies:
1. gnome-session is the session manager for GNOME
2. Should a new session manager is to replace gnome-session, this patch
   will have to forward port. Service guranteed.

If Mark is happy to this SIMPLE patch with BIG assumptions, I am happy to
cook/bake the patch until it is acceptable :)


[1] attached is the patch we use for our GNOME 2.6 based JDS. Its simplistic
but serve its purpose.


desktop-devel-list mailing list
desktop-devel-list gnome org

--- gnome-session-2.6.0/gnome-session/main.c	2004-04-02 17:01:25.000000000 +0530
+++ gnome-session-2.6.0-new/gnome-session/main.c	2004-04-02 17:14:34.000000000 +0530
@@ -20,6 +20,8 @@
 #include <config.h>
 #include <stdio.h>
+#include <X11/Xlib.h>
+#include <gdk/gdkx.h>
 #include <gtk/gtk.h>
 #include <signal.h>
 #include <stdlib.h>
@@ -328,6 +330,8 @@ main (int argc, char *argv[])
   gboolean a_t_support;
   GError *err;
   int status;
+  Display *xdisp;
+  GdkDisplay *gdisp;
   if (getenv ("GSM_VERBOSE_DEBUG"))
     gsm_set_verbose (TRUE);
@@ -401,6 +405,10 @@ main (int argc, char *argv[])
   ep = g_strconcat ("DISPLAY=", gdk_get_display (), NULL);
   putenv (ep);
+  gdisp = gdk_display_get_default();
+  xdisp = gdk_x11_display_get_xdisplay (gdisp);
+  XInternAtom (xdisp, "GNOME_SM_DESKTOP", FALSE);
   ignore (SIGPIPE);
   /* Need DISPLAY set */

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]