Replacing SchemeSel background for systray with that of SchemeNorm

This commit is contained in:
bakkeby 2020-03-22 19:39:08 +01:00
parent 9344ff61dd
commit 39df3ca2ec
2 changed files with 10 additions and 12 deletions

1
dwm.c
View File

@ -1658,6 +1658,7 @@ drawbars(void)
#if SYSTRAY_PATCH #if SYSTRAY_PATCH
if (showsystray) { if (showsystray) {
/* Clear status bar to avoid artifacts beneath systray icons */ /* Clear status bar to avoid artifacts beneath systray icons */
drw_setscheme(drw, scheme[SchemeNorm]);
drw_rect(drw, 0, 0, selmon->ww, bh, 1, 1); drw_rect(drw, 0, 0, selmon->ww, bh, 1, 1);
drw_map(drw, selmon->barwin, 0, 0, selmon->ww, bh); drw_map(drw, selmon->barwin, 0, 0, selmon->ww, bh);
} }

View File

@ -75,23 +75,18 @@ updatesystray(void)
if (!(systray = (Systray *)calloc(1, sizeof(Systray)))) if (!(systray = (Systray *)calloc(1, sizeof(Systray))))
die("fatal: could not malloc() %u bytes\n", sizeof(Systray)); die("fatal: could not malloc() %u bytes\n", sizeof(Systray));
wa.override_redirect = True;
wa.event_mask = ButtonPressMask|ExposureMask;
wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
wa.border_pixel = 0;
#if ALPHA_PATCH #if ALPHA_PATCH
XSetWindowAttributes wa = { wa.colormap = cmap;
.override_redirect = True,
.background_pixel = scheme[SchemeNorm][ColBg].pixel,
.border_pixel = 0,
.colormap = cmap,
.event_mask = ButtonPressMask|ExposureMask
};
systray->win = XCreateWindow(dpy, root, x - xpad, m->by + ypad, w, bh, 0, depth, systray->win = XCreateWindow(dpy, root, x - xpad, m->by + ypad, w, bh, 0, depth,
InputOutput, visual, InputOutput, visual,
CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa); CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa);
#else #else
systray->win = XCreateSimpleWindow(dpy, root, x - xpad, m->by + ypad, w, bh, 0, 0, scheme[SchemeSel][ColBg].pixel); systray->win = XCreateSimpleWindow(dpy, root, x - xpad, m->by + ypad, w, bh, 0, 0, scheme[SchemeNorm][ColBg].pixel);
wa.event_mask = ButtonPressMask | ExposureMask; XChangeWindowAttributes(dpy, systray->win, CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWEventMask, &wa);
wa.override_redirect = True;
wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
XChangeWindowAttributes(dpy, systray->win, CWEventMask|CWOverrideRedirect|CWBackPixel, &wa);
#endif // ALPHA_PATCH #endif // ALPHA_PATCH
XSelectInput(dpy, systray->win, SubstructureNotifyMask); XSelectInput(dpy, systray->win, SubstructureNotifyMask);
XChangeProperty(dpy, systray->win, netatom[NetSystemTrayOrientation], XA_CARDINAL, 32, XChangeProperty(dpy, systray->win, netatom[NetSystemTrayOrientation], XA_CARDINAL, 32,
@ -115,6 +110,8 @@ updatesystray(void)
return; return;
} }
} }
drw_setscheme(drw, scheme[SchemeNorm]);
for (w = 0, i = systray->icons; i; i = i->next) { for (w = 0, i = systray->icons; i; i = i->next) {
/* make sure the background color stays the same */ /* make sure the background color stays the same */
wa.background_pixel = scheme[SchemeNorm][ColBg].pixel; wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;