set conky in dock mode to be withdrawn
authorPhil Sutter <phil@nwl.cc>
Sun, 7 Dec 2008 20:44:56 +0000 (21:44 +0100)
committerPhil Sutter <phil@nwl.cc>
Mon, 8 Dec 2008 00:45:12 +0000 (01:45 +0100)
Withdrawn windows are those you get from applications supporting the
'-w' flag, like e.g. gkrellm or all those sweet WindowMaker dockapps
(wmcpu and Co.). In Fluxbox, these windows are drawn into the slit. Most
other window managers put them into their "taskbar", AFAIK.
This patch makes Conky act exactly the same if the following settings
are selected:

| own_window yes
| own_window_type dock

src/conky.c
src/x11.c

index d4b48b5..50b96b2 100644 (file)
@@ -8481,7 +8481,9 @@ static void load_config_file(const char *f)
 
 #ifdef X11
                CONF2("alignment") {
-                       if (value) {
+                       if (window.type == TYPE_DOCK)
+                               ;
+                       else if (value) {
                                int a = string_to_alignment(value);
 
                                if (a <= 0) {
@@ -8954,6 +8956,7 @@ static void load_config_file(const char *f)
                                        window.type = TYPE_DESKTOP;
                                } else if (strncmp(value, "dock", 7) == EQUAL) {
                                        window.type = TYPE_DOCK;
+                                       text_alignment = TOP_LEFT;
                                } else if (strncmp(value, "override", 8) == EQUAL) {
                                        window.type = TYPE_OVERRIDE;
                                } else {
index 60e09de..21fc5de 100644 (file)
--- a/src/x11.c
+++ b/src/x11.c
@@ -252,6 +252,9 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
                        XWMHints wmHint;
                        Atom xa;
 
+                       if (window.type == TYPE_DOCK) {
+                               window.x = window.y = 0;
+                       }
                        /* Parent is root window so WM can take control */
                        window.window = XCreateWindow(display, window.root, window.x,
                                window.y, w, h, 0, CopyFromParent, InputOutput, CopyFromParent,
@@ -264,7 +267,8 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
                        /* allow decorated windows to be given input focus by WM */
                        wmHint.input =
                                TEST_HINT(window.hints, HINT_UNDECORATED) ? False : True;
-                       wmHint.initial_state = NormalState;
+                       wmHint.initial_state = ((window.type == TYPE_DOCK) ?
+                                               WithdrawnState : NormalState);
 
                        XmbSetWMProperties(display, window.window, window.title, NULL, argv,
                                argc, NULL, &wmHint, &classHint);