diff --git a/client.c b/client.c index 5ec16338..9a6f0d67 100644 --- a/client.c +++ b/client.c @@ -507,6 +507,18 @@ client_unmanage(Client *c, long state) p_delete(&c); } +void +client_updatewmhints(Client *c) +{ + XWMHints *wmh; + + if((wmh = XGetWMHints(globalconf.display, c->win))) + { + c->isurgent = (wmh->flags & XUrgencyHint); + XFree(wmh); + } +} + void client_updatesizehints(Client *c) { diff --git a/client.h b/client.h index 11571c27..87e131ad 100644 --- a/client.h +++ b/client.h @@ -34,6 +34,7 @@ void client_manage(Window, XWindowAttributes *, int); void client_resize(Client *, int, int, int, int, Bool, Bool); void client_unban(Client *); void client_unmanage(Client *, long); +void client_updatewmhints(Client *); void client_updatesizehints(Client *); void client_updatetitle(Client *); void client_saveprops(Client *, int); diff --git a/config.c b/config.c index 86531ccc..960cb3c1 100644 --- a/config.c +++ b/config.c @@ -327,6 +327,8 @@ config_parse(const char *confpatharg) CFG_STR((char *) "focus_border", (char *) "#6666ff", CFGF_NONE), CFG_STR((char *) "focus_bg", (char *) "#6666ff", CFGF_NONE), CFG_STR((char *) "focus_fg", (char *) "#ffffff", CFGF_NONE), + CFG_STR((char *) "urgent_bg", (char *) "#ff0000", CFGF_NONE), + CFG_STR((char *) "urgent_fg", (char *) "#ffffff", CFGF_NONE), CFG_STR((char *) "tab_border", (char *) "#ff0000", CFGF_NONE), CFG_END() }; @@ -551,17 +553,21 @@ config_parse(const char *confpatharg) eprint("awesome: cannot init font\n"); /* Colors */ virtscreen->colors_normal[ColBorder] = initxcolor(screen, - cfg_getstr(cfg_colors, "normal_border")); + cfg_getstr(cfg_colors, "normal_border")); virtscreen->colors_normal[ColBG] = initxcolor(screen, - cfg_getstr(cfg_colors, "normal_bg")); + cfg_getstr(cfg_colors, "normal_bg")); virtscreen->colors_normal[ColFG] = initxcolor(screen, - cfg_getstr(cfg_colors, "normal_fg")); + cfg_getstr(cfg_colors, "normal_fg")); virtscreen->colors_selected[ColBorder] = initxcolor(screen, - cfg_getstr(cfg_colors, "focus_border")); + cfg_getstr(cfg_colors, "focus_border")); virtscreen->colors_selected[ColBG] = initxcolor(screen, - cfg_getstr(cfg_colors, "focus_bg")); + cfg_getstr(cfg_colors, "focus_bg")); virtscreen->colors_selected[ColFG] = initxcolor(screen, - cfg_getstr(cfg_colors, "focus_fg")); + cfg_getstr(cfg_colors, "focus_fg")); + virtscreen->colors_urgent[ColBG] = initxcolor(screen, + cfg_getstr(cfg_colors, "urgent_bg")); + virtscreen->colors_urgent[ColFG] = initxcolor(screen, + cfg_getstr(cfg_colors, "urgent_fg")); /* Statusbar */ virtscreen->statusbar = p_new(Statusbar, 1); diff --git a/config.h b/config.h index 2b326f08..2a996098 100644 --- a/config.h +++ b/config.h @@ -31,8 +31,9 @@ enum { BarTop, BarBot, BarLeft, BarRight, BarOff }; +/** Common colors */ enum -{ ColBorder, ColFG, ColBG, ColLast }; /* color */ +{ ColBorder, ColFG, ColBG, ColLast }; enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ @@ -114,6 +115,8 @@ struct Client int minax, maxax, minay, maxay; long flags; int border, oldborder; + /** Has urgency hint */ + Bool isurgent; /** Store previous floating state before maximizing */ Bool wasfloating; /** True if the window is floating */ @@ -205,6 +208,8 @@ typedef struct XColor colors_normal[ColLast]; /** Selected colors */ XColor colors_selected[ColLast]; + /** Urgency colors */ + XColor colors_urgent[ColLast]; /** Tag list */ Tag *tags; TagClientLink *tclink; diff --git a/event.c b/event.c index 6f2780c3..5fcae3af 100644 --- a/event.c +++ b/event.c @@ -357,6 +357,10 @@ handle_event_propertynotify(XEvent * e) case XA_WM_NORMAL_HINTS: client_updatesizehints(c); break; + case XA_WM_HINTS: + client_updatewmhints(c); + statusbar_draw(c->screen); + break; } if(ev->atom == XA_WM_NAME || ev->atom == XInternAtom(c->display, "_NET_WM_NAME", False)) { diff --git a/tag.c b/tag.c index e6b00fbf..3139b903 100644 --- a/tag.c +++ b/tag.c @@ -84,6 +84,9 @@ is_client_tagged(Client *c, Tag *t, int screen) { TagClientLink *tc; + if(!c || c->screen != screen) + return False; + for(tc = globalconf.screens[screen].tclink; tc; tc = tc->next) if(tc->client == c && tc->tag == t) return True; diff --git a/widgets/taglist.c b/widgets/taglist.c index cc145479..b72e5760 100644 --- a/widgets/taglist.c +++ b/widgets/taglist.c @@ -39,11 +39,23 @@ isoccupied(int screen, Tag *t) Client *c; for(c = globalconf.clients; c; c = c->next) - if(c->screen == screen && is_client_tagged(c, t, screen)) + if(is_client_tagged(c, t, screen)) return True; return False; } +static Bool +isurgent(int screen, Tag *t) +{ + Client *c; + + for(c = globalconf.clients; c; c = c->next) + if(is_client_tagged(c, t, screen) && c->isurgent) + return True; + + return False; +} + static int taglist_draw(Widget *widget, DrawCtx *ctx, @@ -73,6 +85,8 @@ taglist_draw(Widget *widget, w = textwidth(ctx, vscreen.font, tag->name); if(tag->selected) colors = vscreen.colors_selected; + else if(isurgent(widget->statusbar->screen, tag)) + colors = vscreen.colors_urgent; else colors = vscreen.colors_normal; draw_text(ctx, location + width, 0, w,