Only in dwm-5.6.1: blinking_urgent.patch Only in dwm-5.6.1: blinking_urgent.patch~ diff -up dwm-5.6.1/dwm.c dwm-5.6.1rc/dwm.c --- dwm-5.6.1/dwm.c 2009-07-26 15:01:50.000000000 +0200 +++ dwm-5.6.1rc/dwm.c 2009-08-22 22:44:53.796226140 +0200 @@ -36,11 +36,13 @@ #include #include #include +#include #ifdef XINERAMA #include #endif /* XINERAMA */ /* macros */ +#define NUM_THREADS 1 #define BUTTONMASK (ButtonPressMask|ButtonReleaseMask) #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask)) #define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= (RY) && (Y) < (RY) + (RH)) @@ -266,6 +268,8 @@ static Display *dpy; static DC dc; static Monitor *mons = NULL, *selmon = NULL; static Window root; +int blinkurgent = True; +int redraw_needed = False; /* configuration, allows nested code to access above variables */ #include "config.h" @@ -496,10 +500,28 @@ cleanupmons(void) { } void +*blinktoggle(void *threadid) { + int temp = 1; + long tid; + tid = (long)threadid; + unsigned int sec; + sec = 1; + while(temp == 1) { + blinkurgent = !blinkurgent; + if(redraw_needed) drawbars(); + sleep(sec); + } + pthread_exit(NULL); +} + + +void clearurgent(Client *c) { XWMHints *wmh; c->isurgent = False; + blinkurgent = False; + redraw_needed = False; if(!(wmh = XGetWMHints(dpy, c->win))) return; wmh->flags &= ~XUrgencyHint; @@ -657,8 +679,8 @@ drawbar(Monitor *m) { if(ISVISIBLE(c)) n++; occ |= c->tags; - if(c->isurgent) - urg |= c->tags; + if(c->isurgent && blinkurgent) + urg |= c->tags; } dc.x = 0; for(i = 0; i < LENGTH(tags); i++) { @@ -1847,6 +1869,12 @@ updatewmhints(Client *c) { } else c->isurgent = (wmh->flags & XUrgencyHint) ? True : False; + if(c->isurgent) { + redraw_needed = True; + } + else { + redraw_needed = False; + } XFree(wmh); } } @@ -1941,7 +1969,8 @@ zoom(const Arg *arg) { int main(int argc, char *argv[]) { - if(argc == 2 && !strcmp("-v", argv[1])) + XInitThreads(); + if(argc == 2 && !strcmp("-v", argv[1])) die("dwm-"VERSION", © 2006-2009 dwm engineers, see LICENSE for details\n"); else if(argc != 1) die("usage: dwm [-v]\n"); @@ -1949,11 +1978,24 @@ main(int argc, char *argv[]) { fputs("warning: no locale support\n", stderr); if(!(dpy = XOpenDisplay(NULL))) die("dwm: cannot open display\n"); + + pthread_t threads[NUM_THREADS]; + int rc; + long t; + for(t=0; t