add support for Urgency hint
This commit is contained in:
parent
2906ead93c
commit
d5d9439777
12
client.c
12
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)
|
||||
{
|
||||
|
|
1
client.h
1
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);
|
||||
|
|
6
config.c
6
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()
|
||||
};
|
||||
|
@ -562,6 +564,10 @@ config_parse(const char *confpatharg)
|
|||
cfg_getstr(cfg_colors, "focus_bg"));
|
||||
virtscreen->colors_selected[ColFG] = initxcolor(screen,
|
||||
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);
|
||||
|
|
7
config.h
7
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;
|
||||
|
|
4
event.c
4
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))
|
||||
{
|
||||
|
|
3
tag.c
3
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;
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue