diff --git a/dwm.c b/dwm.c index aa3b145..d7087f1 100644 --- a/dwm.c +++ b/dwm.c @@ -1133,6 +1133,8 @@ cleanupmon(Monitor *mon) XDestroyWindow(dpy, bar->win); } mon->bar = bar->next; + if (systray && bar == systray->bar) + systray->bar = NULL; free(bar); } free(mon); @@ -1265,7 +1267,7 @@ configurenotify(XEvent *e) sw = ev->width; sh = ev->height; if (updategeom() || dirty) { - drw_resize(drw, sw, bh); + drw_resize(drw, sw, sh); updatebars(); for (m = mons; m; m = m->next) { #if !FAKEFULLSCREEN_PATCH @@ -1638,11 +1640,12 @@ drawbars(void) void drawbarwin(Bar *bar) { - if (!bar->win || bar->external) + if (!bar || !bar->win || bar->external) return; int r, w, total_drawn = 0; int rx, lx, rw, lw; // bar size, split between left and right if a center module is added const BarRule *br; + Monitor *lastmon; if (bar->borderpx) { XSetForeground(drw->dpy, drw->gc, scheme[bar->borderscheme][ColBorder].pixel); @@ -1656,13 +1659,16 @@ drawbarwin(Bar *bar) rw = lw = bar->bw - 2 * bar->borderpx; rx = lx = bar->borderpx; + for (lastmon = mons; lastmon && lastmon->next; lastmon = lastmon->next); + drw_setscheme(drw, scheme[SchemeNorm]); drw_rect(drw, lx, bar->borderpx, lw, bar->bh - 2 * bar->borderpx, 1, 1); for (r = 0; r < LENGTH(barrules); r++) { br = &barrules[r]; if (br->bar != bar->idx || !br->widthfunc || (br->monitor == 'A' && bar->mon != selmon)) continue; - if (br->monitor != 'A' && br->monitor != -1 && br->monitor != bar->mon->index) + if (br->monitor != 'A' && br->monitor != -1 && br->monitor != bar->mon->index && + (br->drawfunc != draw_systray || (lastmon->index >= br->monitor && bar->mon->index == 0))) // hack: draw systray on first monitor if the designated one is not available continue; drw_setscheme(drw, scheme[SchemeNorm]); warg.w = (br->alignment < BAR_ALIGN_RIGHT_LEFT ? lw : rw);