Add statusline option in [tag]

This commit is contained in:
Martin Duquesnoy 2012-02-06 11:31:29 +01:00
parent 5508a565a1
commit 95c3224ad4
4 changed files with 19 additions and 2 deletions

View File

@ -177,9 +177,10 @@ static void
config_tag(void)
{
struct screen *s;
struct tag *t;
size_t i, n;
struct conf_sec *sec, **ks, **mb;
char *name;
char *name, *tmp;
int screenid;
/* [tags] */
@ -202,7 +203,14 @@ config_tag(void)
SLIST_FOREACH(s, &W->h.screen, next)
if(screenid == s->id || screenid == -1)
tag_new(s, name);
{
t = tag_new(s, name);
t->statusctx = status_new_ctx(NULL, NULL);
ISTRDUP(t->statusctx.status, fetch_opt_first(ks[i], "", "statusline").str);
if(t->statusctx.status)
status_parse(&t->statusctx);
}
}
/* If no tag at all on a screen, add one anyway */

View File

@ -77,6 +77,9 @@ infobar_elem_tag_init(struct element *e)
/* Init barwin */
b = barwin_new(e->infobar->bar->win, j, 0, s, e->geo.h, 0, 0, false);
/* Status doesn't have theme yet */
t->statusctx.theme = e->infobar->theme;
/* Set border */
if(e->infobar->theme->tags_border_width)
{
@ -154,6 +157,10 @@ infobar_elem_tag_update(struct element *e)
status_copy_mousebind(e->statusctx);
status_render(e->statusctx);
t->statusctx.barwin = b;
status_copy_mousebind(&t->statusctx);
status_render(&t->statusctx);
draw_text(b->dr, e->infobar->theme, (PAD >> 1),
TEXTY(e->infobar->theme, e->geo.h), b->fg, t->name);

View File

@ -175,6 +175,7 @@ struct tag
struct client *sel;
struct client *prevsel;
struct tag *prev;
struct status_ctx statusctx;
char *name;
int id;
#define TAG_URGENT 0x01

1
wmfsrc
View File

@ -93,6 +93,7 @@
[tag]
screen = -1
name = "1"
# statusline=""
[/tag]
[tag] name = "2" [/tag]