diff --git a/config.h b/config.h index f35e51f..d1d7568 100644 --- a/config.h +++ b/config.h @@ -1,29 +1,31 @@ /* See LICENSE file for copyright and license details. */ /* appearance */ -static const unsigned int borderpx = 1; /* border pixel of windows */ -static const unsigned int snap = 32; /* snap pixel */ -static const unsigned int gappih = 20; /* horiz inner gap between windows */ -static const unsigned int gappiv = 10; /* vert inner gap between windows */ -static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */ -static const unsigned int gappov = 30; /* vert outer gap between windows and screen edge */ -static int smartgaps = 0; /* 1 means no outer gap when there is only one window */ -static const int showbar = 1; /* 0 means no bar */ -static const int topbar = 1; /* 0 means bottom bar */ +static const unsigned int borderpx = 1; /* border pixel of windows */ +static const unsigned int snap = 32; /* snap pixel */ +static const unsigned int gappih = 20; /* horiz inner gap between windows */ +static const unsigned int gappiv = 10; /* vert inner gap between windows */ +static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */ +static const unsigned int gappov = 30; /* vert outer gap between windows and screen edge */ +static int smartgaps = 0; /* 1 means no outer gap when there is only one window */ +static const int showbar = 1; /* 0 means no bar */ +static const int topbar = 1; /* 0 means bottom bar */ static const unsigned int systrayspacing = 2; /* systray spacing */ static const int showsystray = 1; /* 0 means no systray */ -static const char statussep = ';'; /* separator between status bars */ -static char font[] = "monospace 10"; -static char col_gray1[] = "#222222"; -static char col_gray2[] = "#444444"; -static char col_gray3[] = "#bbbbbb"; -static char col_gray4[] = "#eeeeee"; -static char col_cyan[] = "#005577"; +static const char statussep = ';'; /* separator between status bars */ +static char font[] = "monospace 10"; +static char col_gray1[] = "#222222"; +static char col_gray2[] = "#444444"; +static char col_gray3[] = "#bbbbbb"; +static char col_gray4[] = "#eeeeee"; +static char col_cyan[] = "#005577"; -static const int monoclenogaps = 1; +static const int hidevacant = 1; +static const int monoclenogaps = 1; /* tagging */ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; +static const char *usedtags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; static const Rule rules[] = { /* xprop(1): @@ -59,7 +61,7 @@ static const BarRule barrules[] = { }; /* layout(s) */ -static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ +static const float mfact = 0.50; /* factor of master area size [0.05..0.95] */ static const int nmaster = 1; /* number of clients in master area */ static const int nstack = 0; /* number of clients in primary stack area */ static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */ @@ -110,7 +112,7 @@ static const Key keys[] = { { MODKEY, XK_j, focusstack, {.i = +1 } }, { MODKEY, XK_k, focusstack, {.i = -1 } }, { MODKEY, XK_i, incnmaster, {.i = +1 } }, - { MODKEY, XK_d, incnmaster, {.i = -1 } }, + { MODKEY, XK_n, incnmaster, {.i = -1 } }, { MODKEY|ControlMask, XK_i, incnstack, {.i = +1 } }, { MODKEY|ControlMask, XK_u, incnstack, {.i = -1 } }, { MODKEY, XK_a, setmfact, {.f = -0.05} }, diff --git a/libs/bar/bar_tags.c b/libs/bar/bar_tags.c index ac7791a..6efd2a5 100644 --- a/libs/bar/bar_tags.c +++ b/libs/bar/bar_tags.c @@ -2,9 +2,21 @@ int width_tags(Bar *bar, BarWidthArg *a) { int w, i; + Client *c; + unsigned int occ = 0; + + if (!hidevacant) { + for (c = bar->mon->clients; c; c = c->next) + occ |= c->tags; + } else { + for (c = bar->mon->clients; c; c = c->next) + occ |= c->tags == 255 ? 0 : c->tags; + } for (w = 0, i = 0; i < LENGTH(tags); i++) { - w += TEXTW(tags[i]); + if (!(occ & 1 << i || bar->mon->tagset[bar->mon->seltags] & 1 << i) && hidevacant) + continue; + w += TEXTW(occ & 1 << i ? usedtags[i] : tags[i]); } return w; } @@ -20,17 +32,24 @@ draw_tags(Bar *bar, BarDrawArg *a) Monitor *m = bar->mon; for (c = m->clients; c; c = c->next) { - occ |= c->tags; + if (!hidevacant) { + occ |= c->tags; + } else { + occ |= c->tags == 255 ? 0 : c->tags; + } + if (c->isurgent) urg |= c->tags; } for (i = 0; i < LENGTH(tags); i++) { + if (!(occ & 1 << i || bar->mon->tagset[bar->mon->seltags] & 1 << i) && hidevacant) + continue; w = TEXTW(tags[i]); int ts = m->tagset[m->seltags] & 1 << i ? 1 : 0; drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i, False, ts ? col_gray4 : col_gray3, ts ? col_cyan : col_gray1, 255, 255); - if (occ & 1 << i) + if (occ & 1 << i && !hidevacant) drw_rect(drw, x + boxs, boxs, boxw, boxw, m == selmon && selmon->sel && selmon->sel->tags & 1 << i, urg & 1 << i, ts ? col_gray4 : col_gray3, ts ? col_cyan : col_gray1, 255, 255); @@ -45,9 +64,21 @@ int click_tags(Bar *bar, Arg *arg, BarClickArg *a) { int i = 0, x = lrpad / 2; + unsigned int occ = 0; + Client *c; + + if (hidevacant) { + for (c = bar->mon->clients; c; c = c->next) + occ |= c->tags == 255 ? 0 : c->tags; + } else { + for (c = bar->mon->clients; c; c = c->next) + occ |= c->tags; + } do { - x += TEXTW(tags[i]); + if (!(occ & 1 << i || bar->mon->tagset[bar->mon->seltags] & 1 << i) && hidevacant) + continue; + x += TEXTW(occ & 1 << i ? usedtags[i] : tags[i]); } while (a->rel_x >= x && ++i < LENGTH(tags)); if (i < LENGTH(tags)) { arg->ui = 1 << i;