mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
anybar: make sure to free the bar when unmanaging an external bar plus misc improvements ref. #118
This commit is contained in:
parent
a7dfcc17d5
commit
eb66da79ca
5
dwm.c
5
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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user