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);
|
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
|
void
|
||||||
client_updatesizehints(Client *c)
|
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_resize(Client *, int, int, int, int, Bool, Bool);
|
||||||
void client_unban(Client *);
|
void client_unban(Client *);
|
||||||
void client_unmanage(Client *, long);
|
void client_unmanage(Client *, long);
|
||||||
|
void client_updatewmhints(Client *);
|
||||||
void client_updatesizehints(Client *);
|
void client_updatesizehints(Client *);
|
||||||
void client_updatetitle(Client *);
|
void client_updatetitle(Client *);
|
||||||
void client_saveprops(Client *, int);
|
void client_saveprops(Client *, int);
|
||||||
|
|
18
config.c
18
config.c
|
@ -327,6 +327,8 @@ config_parse(const char *confpatharg)
|
||||||
CFG_STR((char *) "focus_border", (char *) "#6666ff", CFGF_NONE),
|
CFG_STR((char *) "focus_border", (char *) "#6666ff", CFGF_NONE),
|
||||||
CFG_STR((char *) "focus_bg", (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 *) "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_STR((char *) "tab_border", (char *) "#ff0000", CFGF_NONE),
|
||||||
CFG_END()
|
CFG_END()
|
||||||
};
|
};
|
||||||
|
@ -551,17 +553,21 @@ config_parse(const char *confpatharg)
|
||||||
eprint("awesome: cannot init font\n");
|
eprint("awesome: cannot init font\n");
|
||||||
/* Colors */
|
/* Colors */
|
||||||
virtscreen->colors_normal[ColBorder] = initxcolor(screen,
|
virtscreen->colors_normal[ColBorder] = initxcolor(screen,
|
||||||
cfg_getstr(cfg_colors, "normal_border"));
|
cfg_getstr(cfg_colors, "normal_border"));
|
||||||
virtscreen->colors_normal[ColBG] = initxcolor(screen,
|
virtscreen->colors_normal[ColBG] = initxcolor(screen,
|
||||||
cfg_getstr(cfg_colors, "normal_bg"));
|
cfg_getstr(cfg_colors, "normal_bg"));
|
||||||
virtscreen->colors_normal[ColFG] = initxcolor(screen,
|
virtscreen->colors_normal[ColFG] = initxcolor(screen,
|
||||||
cfg_getstr(cfg_colors, "normal_fg"));
|
cfg_getstr(cfg_colors, "normal_fg"));
|
||||||
virtscreen->colors_selected[ColBorder] = initxcolor(screen,
|
virtscreen->colors_selected[ColBorder] = initxcolor(screen,
|
||||||
cfg_getstr(cfg_colors, "focus_border"));
|
cfg_getstr(cfg_colors, "focus_border"));
|
||||||
virtscreen->colors_selected[ColBG] = initxcolor(screen,
|
virtscreen->colors_selected[ColBG] = initxcolor(screen,
|
||||||
cfg_getstr(cfg_colors, "focus_bg"));
|
cfg_getstr(cfg_colors, "focus_bg"));
|
||||||
virtscreen->colors_selected[ColFG] = initxcolor(screen,
|
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 */
|
/* Statusbar */
|
||||||
virtscreen->statusbar = p_new(Statusbar, 1);
|
virtscreen->statusbar = p_new(Statusbar, 1);
|
||||||
|
|
7
config.h
7
config.h
|
@ -31,8 +31,9 @@
|
||||||
enum
|
enum
|
||||||
{ BarTop, BarBot, BarLeft, BarRight, BarOff };
|
{ BarTop, BarBot, BarLeft, BarRight, BarOff };
|
||||||
|
|
||||||
|
/** Common colors */
|
||||||
enum
|
enum
|
||||||
{ ColBorder, ColFG, ColBG, ColLast }; /* color */
|
{ ColBorder, ColFG, ColBG, ColLast };
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{ CurNormal, CurResize, CurMove, CurLast }; /* cursor */
|
{ CurNormal, CurResize, CurMove, CurLast }; /* cursor */
|
||||||
|
@ -114,6 +115,8 @@ struct Client
|
||||||
int minax, maxax, minay, maxay;
|
int minax, maxax, minay, maxay;
|
||||||
long flags;
|
long flags;
|
||||||
int border, oldborder;
|
int border, oldborder;
|
||||||
|
/** Has urgency hint */
|
||||||
|
Bool isurgent;
|
||||||
/** Store previous floating state before maximizing */
|
/** Store previous floating state before maximizing */
|
||||||
Bool wasfloating;
|
Bool wasfloating;
|
||||||
/** True if the window is floating */
|
/** True if the window is floating */
|
||||||
|
@ -205,6 +208,8 @@ typedef struct
|
||||||
XColor colors_normal[ColLast];
|
XColor colors_normal[ColLast];
|
||||||
/** Selected colors */
|
/** Selected colors */
|
||||||
XColor colors_selected[ColLast];
|
XColor colors_selected[ColLast];
|
||||||
|
/** Urgency colors */
|
||||||
|
XColor colors_urgent[ColLast];
|
||||||
/** Tag list */
|
/** Tag list */
|
||||||
Tag *tags;
|
Tag *tags;
|
||||||
TagClientLink *tclink;
|
TagClientLink *tclink;
|
||||||
|
|
4
event.c
4
event.c
|
@ -357,6 +357,10 @@ handle_event_propertynotify(XEvent * e)
|
||||||
case XA_WM_NORMAL_HINTS:
|
case XA_WM_NORMAL_HINTS:
|
||||||
client_updatesizehints(c);
|
client_updatesizehints(c);
|
||||||
break;
|
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))
|
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;
|
TagClientLink *tc;
|
||||||
|
|
||||||
|
if(!c || c->screen != screen)
|
||||||
|
return False;
|
||||||
|
|
||||||
for(tc = globalconf.screens[screen].tclink; tc; tc = tc->next)
|
for(tc = globalconf.screens[screen].tclink; tc; tc = tc->next)
|
||||||
if(tc->client == c && tc->tag == t)
|
if(tc->client == c && tc->tag == t)
|
||||||
return True;
|
return True;
|
||||||
|
|
|
@ -39,11 +39,23 @@ isoccupied(int screen, Tag *t)
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
for(c = globalconf.clients; c; c = c->next)
|
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 True;
|
||||||
return False;
|
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
|
static int
|
||||||
taglist_draw(Widget *widget,
|
taglist_draw(Widget *widget,
|
||||||
DrawCtx *ctx,
|
DrawCtx *ctx,
|
||||||
|
@ -73,6 +85,8 @@ taglist_draw(Widget *widget,
|
||||||
w = textwidth(ctx, vscreen.font, tag->name);
|
w = textwidth(ctx, vscreen.font, tag->name);
|
||||||
if(tag->selected)
|
if(tag->selected)
|
||||||
colors = vscreen.colors_selected;
|
colors = vscreen.colors_selected;
|
||||||
|
else if(isurgent(widget->statusbar->screen, tag))
|
||||||
|
colors = vscreen.colors_urgent;
|
||||||
else
|
else
|
||||||
colors = vscreen.colors_normal;
|
colors = vscreen.colors_normal;
|
||||||
draw_text(ctx, location + width, 0, w,
|
draw_text(ctx, location + width, 0, w,
|
||||||
|
|
Loading…
Reference in New Issue