From 39df3ca2ec42a72ad97946a1bb2519e9bd711718 Mon Sep 17 00:00:00 2001 From: bakkeby Date: Sun, 22 Mar 2020 19:39:08 +0100 Subject: [PATCH] Replacing SchemeSel background for systray with that of SchemeNorm --- dwm.c | 1 + patch/systray.c | 21 +++++++++------------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/dwm.c b/dwm.c index a9b70e5..5c14ada 100644 --- a/dwm.c +++ b/dwm.c @@ -1658,6 +1658,7 @@ drawbars(void) #if SYSTRAY_PATCH if (showsystray) { /* 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_map(drw, selmon->barwin, 0, 0, selmon->ww, bh); } diff --git a/patch/systray.c b/patch/systray.c index bf30073..e3b0796 100644 --- a/patch/systray.c +++ b/patch/systray.c @@ -75,23 +75,18 @@ updatesystray(void) if (!(systray = (Systray *)calloc(1, 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 - XSetWindowAttributes wa = { - .override_redirect = True, - .background_pixel = scheme[SchemeNorm][ColBg].pixel, - .border_pixel = 0, - .colormap = cmap, - .event_mask = ButtonPressMask|ExposureMask - }; + wa.colormap = cmap; systray->win = XCreateWindow(dpy, root, x - xpad, m->by + ypad, w, bh, 0, depth, InputOutput, visual, CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa); #else - systray->win = XCreateSimpleWindow(dpy, root, x - xpad, m->by + ypad, w, bh, 0, 0, scheme[SchemeSel][ColBg].pixel); - wa.event_mask = ButtonPressMask | ExposureMask; - wa.override_redirect = True; - wa.background_pixel = scheme[SchemeNorm][ColBg].pixel; - XChangeWindowAttributes(dpy, systray->win, CWEventMask|CWOverrideRedirect|CWBackPixel, &wa); + systray->win = XCreateSimpleWindow(dpy, root, x - xpad, m->by + ypad, w, bh, 0, 0, scheme[SchemeNorm][ColBg].pixel); + XChangeWindowAttributes(dpy, systray->win, CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWEventMask, &wa); #endif // ALPHA_PATCH XSelectInput(dpy, systray->win, SubstructureNotifyMask); XChangeProperty(dpy, systray->win, netatom[NetSystemTrayOrientation], XA_CARDINAL, 32, @@ -115,6 +110,8 @@ updatesystray(void) return; } } + + drw_setscheme(drw, scheme[SchemeNorm]); for (w = 0, i = systray->icons; i; i = i->next) { /* make sure the background color stays the same */ wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;