Infobar: Add autohide option in [tags]: Hide empty tags in tag list (Feature #24 requested by Erus)

This commit is contained in:
Martin Duquesnoy 2010-04-18 17:38:12 +02:00
parent 3811d61858
commit 8c0e37cb38
4 changed files with 31 additions and 2 deletions

View File

@ -449,6 +449,7 @@ conf_tag_section(void)
conf.colors.tagurbg = getcolor(fetch_opt_first(sec, "#DD1111", "urgent_bg").str);
conf.colors.tag_occupied_bg = getcolor(fetch_opt_first(sec, "#222222", "occupied_bg").str);
conf.border.tag = fetch_opt_first(sec, "false", "border").bool;
conf.tagautohide = fetch_opt_first(sec, "false", "autohide").bool;
/* Mouse button action on tag */
conf.mouse_tag_action[TagSel] =

View File

@ -156,6 +156,9 @@ infobar_draw(int sc)
void
infobar_draw_layout(int sc)
{
if(!conf.layout_placement)
barwin_move(infobar[sc].layout_button, infobar[sc].tags_board->geo.width + PAD / 2, 0);
barwin_resize(infobar[sc].layout_button, textw(tags[sc][seltag[sc]].layout.symbol) + PAD, infobar[sc].geo.height);
barwin_refresh_color(infobar[sc].layout_button);
@ -216,7 +219,7 @@ infobar_draw_selbar(int sc)
void
infobar_draw_taglist(int sc)
{
int i;
int i, x;
Client *c;
Bool is_occupied[MAXTAG];
@ -230,8 +233,29 @@ infobar_draw_taglist(int sc)
if(c->screen == sc)
is_occupied[c->tag] = True;
for(i = 1; i < conf.ntag[sc] + 1; ++i)
for(i = 1, x = 0; i < conf.ntag[sc] + 1; ++i)
{
/* Autohide tag feature */
if(conf.tagautohide)
{
if(!is_occupied[i] && i != seltag[sc])
{
barwin_unmap(infobar[sc].tags[i]);
continue;
}
if(!infobar[sc].tags[i]->mapped)
barwin_map(infobar[sc].tags[i]);
barwin_move(infobar[sc].tags[i], x, 0);
x += infobar[sc].tags[i]->geo.width;
barwin_resize(infobar[sc].tags_board, x, infobar[sc].geo.height);
}
infobar[sc].tags[i]->bg = tags[sc][i].urgent
? conf.colors.tagurbg
: ((i == seltag[sc] || tags[sc][seltag[sc]].tagad & TagFlag(i))

View File

@ -343,6 +343,7 @@ typedef struct
Bool focus_fmouse;
Bool focus_pclick;
Bool ignore_next_client_rules;
Bool tagautohide;
uint pad;
int status_timing;
char *status_path;

View File

@ -74,6 +74,9 @@
# Border around the tag buttons.
border = true
# Hide empty tags in tag list
autohide = false
# Mouse buttons action on tag.
mouse_button_tag_sel = "1"
mouse_button_tag_transfert = "2"