Removing shadow of dwm system tray
Most systray patches manage systray icons in a window separate from the bar in dwm, and just allocates free space within the bar or next to it for the systray window.
Shadows are added by the compositor like picom, but the compositor has no way to identify this systray window hence there is no way to exclude shadows being drawn for that specific window.
To fix this, add class hints that you can use in the compositor configuration when it comes to excluding shadows. In the clientmessage function of dwm.c, add the following [reference];
XClassHint ch = {"dwmsystray", "dwmsystray"};
XSetClassHint(dpy, c->win, &ch);
like the following for instance;
updatesizehints(c);
updatesystrayicongeom(c, wa.width, wa.height);
XAddToSaveSet(dpy, c->win);
XSelectInput(dpy, c->win, StructureNotifyMask | PropertyChangeMask | ResizeRedirectMask);
XClassHint ch = {"dwmsystray", "dwmsystray"};
XSetClassHint(dpy, c->win, &ch);
XReparentWindow(dpy, c->win, systray->win, 0, 0);
/* use parents background color */
swa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
XChangeWindowAttributes(dpy, c->win, CWBackPixel, &swa);
Then add the class hint "dwmsystray" to the shadow-exclude setting in the picom.conf.
shadow-exclude = [
...
"class_g = 'dwmsystray'",
...
];
done.
see: https://github.com/bakkeby/dwm-flexipatch/discussions/134
see: https://github.com/bakkeby/dwm-flexipatch/commit/d85dc0404f5542b4d9800e2db91df7a577b7f6f2