[taglist] Add show_empty option
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
c774a01b9b
commit
08b2949e69
|
@ -42,6 +42,7 @@ DO_SLIST(taglist_drawn_area_t, taglist_drawn_area, p_delete);
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char *text_normal, *text_focus, *text_urgent;
|
char *text_normal, *text_focus, *text_urgent;
|
||||||
|
bool show_empty;
|
||||||
taglist_drawn_area_t *drawn_area;
|
taglist_drawn_area_t *drawn_area;
|
||||||
|
|
||||||
} taglist_data_t;
|
} taglist_data_t;
|
||||||
|
@ -168,6 +169,9 @@ taglist_draw(widget_node_t *w,
|
||||||
tag && area;
|
tag && area;
|
||||||
tag = tag->next, area = area->next, i++)
|
tag = tag->next, area = area->next, i++)
|
||||||
{
|
{
|
||||||
|
if (!data->show_empty && !tag->selected && !tag_isoccupied(tag))
|
||||||
|
continue;
|
||||||
|
|
||||||
area->x = w->area.x + prev_width;
|
area->x = w->area.x + prev_width;
|
||||||
prev_width += area->width;
|
prev_width += area->width;
|
||||||
draw_text(ctx, globalconf.font, &statusbar->colors.fg, *area, text[i]);
|
draw_text(ctx, globalconf.font, &statusbar->colors.fg, *area, text[i]);
|
||||||
|
@ -261,6 +265,8 @@ taglist_tell(widget_t *widget, const char *property, const char *new_value)
|
||||||
p_delete(&d->text_urgent);
|
p_delete(&d->text_urgent);
|
||||||
d->text_urgent = a_strdup(new_value);
|
d->text_urgent = a_strdup(new_value);
|
||||||
}
|
}
|
||||||
|
else if(!a_strcmp(property, "show_empty"))
|
||||||
|
d->show_empty = a_strtobool(new_value);
|
||||||
else
|
else
|
||||||
return WIDGET_ERROR;
|
return WIDGET_ERROR;
|
||||||
|
|
||||||
|
@ -284,6 +290,7 @@ taglist_new(alignment_t align)
|
||||||
d->text_normal = a_strdup(" <text align=\"center\"/><title/> ");
|
d->text_normal = a_strdup(" <text align=\"center\"/><title/> ");
|
||||||
d->text_focus = a_strdup(" <text align=\"center\"/><title/> ");
|
d->text_focus = a_strdup(" <text align=\"center\"/><title/> ");
|
||||||
d->text_urgent = a_strdup(" <text align=\"center\"/><title/> ");
|
d->text_urgent = a_strdup(" <text align=\"center\"/><title/> ");
|
||||||
|
d->show_empty = true;
|
||||||
|
|
||||||
/* Set cache property */
|
/* Set cache property */
|
||||||
w->cache_flags = WIDGET_CACHE_TAGS | WIDGET_CACHE_CLIENTS;
|
w->cache_flags = WIDGET_CACHE_TAGS | WIDGET_CACHE_CLIENTS;
|
||||||
|
|
Loading…
Reference in New Issue