summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--config.def.h2
-rw-r--r--dwm.c27
2 files changed, 16 insertions, 13 deletions
diff --git a/config.def.h b/config.def.h
index 9c6dc83..1b5b710 100644
--- a/config.def.h
+++ b/config.def.h
@@ -3,7 +3,6 @@
/* appearance */
static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */
-static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
static const char *fonts[] = { "monospace:size=10" };
static const char dmenufont[] = "monospace:size=10";
@@ -78,7 +77,6 @@ static const Key keys[] = {
{ MODKEY|ShiftMask, XK_z, spawn, {.v = slockucmd } },
{ MODKEY|ShiftMask, XK_backslash, spawn, {.v = browsercmd } },
{ MODKEY|ControlMask|ShiftMask, XK_backslash, spawn, {.v = browserpcmd } },
- { MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
diff --git a/dwm.c b/dwm.c
index 7ca234b..672a4e2 100644
--- a/dwm.c
+++ b/dwm.c
@@ -211,7 +211,6 @@ static void spawn(const Arg *arg);
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
static void tile(Monitor *m);
-static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
@@ -390,6 +389,21 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact)
void
arrange(Monitor *m)
{
+ unsigned int occ;
+ Client *c;
+
+ if (m)
+ {
+ occ = m->tagset[m->seltags];
+
+ for (c = m->clients; c; c = c->next)
+ occ |= c->tags;
+
+ selmon->showbar = __builtin_popcount(occ & TAGMASK) > 1;
+ updatebarpos(selmon);
+ XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
+ }
+
if (m)
showhide(m->stack);
else for (m = mons; m; m = m->next)
@@ -647,7 +661,7 @@ createmon(void)
m->tagset[0] = m->tagset[1] = 1;
m->mfact = mfact;
m->nmaster = nmaster;
- m->showbar = showbar;
+ m->showbar = 0;
m->topbar = topbar;
m->lt[0] = &layouts[0];
m->lt[1] = &layouts[1 % LENGTH(layouts)];
@@ -1722,15 +1736,6 @@ tile(Monitor *m)
}
void
-togglebar(const Arg *arg)
-{
- selmon->showbar = !selmon->showbar;
- updatebarpos(selmon);
- XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
- arrange(selmon);
-}
-
-void
togglefloating(const Arg *arg)
{
if (!selmon->sel)