summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--dwm.c5
-rw-r--r--patch/bar_anybar.c19
-rw-r--r--patches.def.h7
3 files changed, 23 insertions, 8 deletions
diff --git a/dwm.c b/dwm.c
index e75f149..4ec1182 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1559,6 +1559,7 @@ createmon(void)
n = MAX(br->bar, n);
}
+ m->bar = NULL;
for (i = 0; i <= n && i < max_bars; i++) {
bar = ecalloc(1, sizeof(Bar));
bar->mon = m;
@@ -2337,7 +2338,7 @@ manage(Window w, XWindowAttributes *wa)
c->y = c->mon->my + c->mon->mh - HEIGHT(c);
c->x = MAX(c->x, c->mon->mx);
/* only fix client y-offset, if the client center might cover the bar */
- c->y = MAX(c->y, ((c->mon->bar->by == c->mon->my) && (c->x + (c->w / 2) >= c->mon->wx)
+ c->y = MAX(c->y, ((!c->mon->bar || c->mon->bar->by == c->mon->my) && (c->x + (c->w / 2) >= c->mon->wx)
&& (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
wc.border_width = c->bw;
@@ -2988,7 +2989,7 @@ restack(Monitor *m)
return;
if (m->sel->isfloating || !m->lt[m->sellt]->arrange)
XRaiseWindow(dpy, m->sel->win);
- if (m->lt[m->sellt]->arrange) {
+ if (m->lt[m->sellt]->arrange && m->bar) {
wc.stack_mode = Below;
wc.sibling = m->bar->win;
for (c = m->stack; c; c = c->snext)
diff --git a/patch/bar_anybar.c b/patch/bar_anybar.c
index 05b2513..fa6b4d2 100644
--- a/patch/bar_anybar.c
+++ b/patch/bar_anybar.c
@@ -12,7 +12,11 @@ managealtbar(Window win, XWindowAttributes *wa)
bar->topbar = topbar;
} else if (bar && bar->win) {
bar->next = ecalloc(1, sizeof(Bar));
+ #if BAR_ANYBAR_STACK_BARS_PATCH
+ bar->next->topbar = topbar;
+ #else
bar->next->topbar = !bar->topbar;
+ #endif // BAR_ANYBAR_STACK_BARS_PATCH
bar = bar->next;
}
bar->external = 1;
@@ -43,18 +47,23 @@ void
unmanagealtbar(Window w)
{
Monitor *m = wintomon(w);
- Bar *bar;
+ Bar *bar, *next, *prev = NULL;
if (!m)
return;
- for (bar = m->bar; bar && bar->win; bar = bar->next)
+ for (bar = m->bar; bar && bar->win; bar = next) {
+ next = bar->next;
if (bar->win == w) {
- bar->win = 0;
- bar->by = 0;
- bar->bh = 0;
+ if (prev)
+ prev->next = next;
+ else
+ m->bar = next;
+ free(bar);
break;
}
+ prev = bar;
+ }
updatebarpos(m);
arrange(m);
}
diff --git a/patches.def.h b/patches.def.h
index 1085cda..c5f45bf 100644
--- a/patches.def.h
+++ b/patches.def.h
@@ -223,12 +223,17 @@
* togglebar affect the external bar in the same way.
*
* NB: Unless you want both anybar + dwm bar(s) then the recommendation is to disable all
- * bar modules and have { 0 } in the barrules.
+ * bar modules and have { -2 } in the barrules.
*
* https://dwm.suckless.org/patches/anybar/
*/
#define BAR_ANYBAR_PATCH 0
+/* Anybar option to stack multiple external bars at the top or at the bottom of the monitor
+ * instead of adding a second bar at the opposite side.
+ */
+#define BAR_ANYBAR_STACK_BARS_PATCH 0
+
/* This patch adds a border around the status bar(s) just like the border of client windows.
* https://codemadness.org/paste/dwm-border-bar.patch
*/