wm_class patch
authorBrenden Matthews <brenden1@rty.ca>
Sat, 29 Oct 2005 01:03:01 +0000 (01:03 +0000)
committerBrenden Matthews <brenden1@rty.ca>
Sat, 29 Oct 2005 01:03:01 +0000 (01:03 +0000)
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@356 7f574dfc-610e-0410-a909-a81674777703

AUTHORS
ChangeLog
src/conky.c
src/conky.h
src/x11.c

diff --git a/AUTHORS b/AUTHORS
index 46a9f2e..38e1d2d 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -31,6 +31,9 @@ David McCabe
 Daniel Thiele <dthiele at gmx dot net>
   APM support for FreeBSD
 
+Denis <d-st at users dot sourceforge dot net>
+  WM_CLASS patch
+
 Dennis Frommknecht
   NVCtrl, temperature monitoring for nvdia-based graphics cards
 
index 9c2631c..4742947 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 # $Id$
 
+2005-10-28
+       * Added WM_CLASS patch from sf.net patch 1340825
+
 2005-10-21
        * acpi segfault should be fixed (sf.net bug 1330893)
        * SIGUSR1 bug fixed? (sf.net bug 1330914)
index 5fd41a2..8724591 100644 (file)
@@ -239,6 +239,7 @@ static int set_transparent = 0;
 #ifdef OWN_WINDOW
 static int own_window = 0;
 static int background_colour = 0;
+static char wm_class_name[256];
 /* fixed size/pos is set if wm/user changes them */
 static int fixed_size = 0, fixed_pos = 0;
 #endif
@@ -4282,6 +4283,7 @@ static void set_default_configurations(void)
        maximum_width = 0;
 #ifdef OWN_WINDOW
        own_window = 0;
+    strcpy(wm_class_name, "conky");
 #endif
        stippled_borders = 0;
        border_margin = 3;
@@ -4640,6 +4642,10 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, b) == 0)
                CONF("own_window") {
                        own_window = string_to_bool(value);
                }
+        CONF("wm_class_name") {
+            strncpy(wm_class_name, value, sizeof(wm_class_name)-1);
+            wm_class_name[sizeof(wm_class_name)-1] = 0;
+        }
                CONF("own_window_transparent") {
                        set_transparent = string_to_bool(value);
                }
@@ -4945,6 +4951,7 @@ int main(int argc, char **argv)
 #if defined OWN_WINDOW
        init_window
            (own_window,
+         wm_class_name,
             text_width + border_margin * 2 + 1,
             text_height + border_margin * 2 + 1,
             on_bottom, fixed_pos, set_transparent, background_colour);
index fa95ba4..034bf7b 100644 (file)
@@ -255,7 +255,7 @@ extern struct conky_window window;
 
 void init_X11();
 #if defined OWN_WINDOW
-void init_window(int use_own_window, int width, int height, int on_bottom, int fixed_pos, int set_trans, int back_colour);
+void init_window(int use_own_window, char* wm_class_name, int width, int height, int on_bottom, int fixed_pos, int set_trans, int back_colour);
 #else
 void init_window(int use_own_window, int width, int height, int on_bottom, int set_trans, int back_colour);
 #endif
index e23fb33..ebdeb7b 100644 (file)
--- a/src/x11.c
+++ b/src/x11.c
@@ -171,7 +171,7 @@ inline void set_transparent_background(Window win)
 }
 
 #if defined OWN_WINDOW
-void init_window(int own_window, int w, int h, int l, int fixed_pos, int set_trans, int back_colour)
+void init_window(int own_window, char* wm_class_name, int w, int h, int l, int fixed_pos, int set_trans, int back_colour)
 #else
 void init_window(int own_window, int w, int h, int l, int set_trans, int back_colour)
 #endif
@@ -207,8 +207,8 @@ void init_window(int own_window, int w, int h, int l, int set_trans, int back_co
 
 
 
-                       class_hints.res_class = "conky";
-                       class_hints.res_name = "conky";
+                       class_hints.res_class = wm_class_name;
+                       class_hints.res_name = wm_class_name;
                        XSetClassHint(display, window.window,
                                      &class_hints);