dwm-winicon is a patch that enables dwm to show window icons.
It is recommended to enable the compiler optimization flags: -O3 and -march=native to enable auto loop vectorize, which leads to better performance.
If you discover any bugs or have any idea to optimize it, feel free to create an issue there.
The patch depends on Imlib2 for icon scaling, which can be easily installed in most distros.
Arch Linux:
sudo pacman -S imlib2
Debian:
sudo apt install libimlib2-dev
#define ICONSIZE 20 /* icon size in pixels */
#define ICONSPACING 5 /* space (pixels) between icon and title */
If you also use alpha patch, some modifications are needed to make dwm work correctly.
- Replace (in drw.c, drw_create function)
drw->picture = XRenderCreatePicture(dpy, drw->drawable, XRenderFindVisualFormat(dpy, DefaultVisual(dpy, screen)), 0, NULL);
with
drw->picture = XRenderCreatePicture(dpy, drw->drawable, XRenderFindVisualFormat(dpy, visual), 0, NULL);
- Replace (in drw.c, drw_resize function)
drw->picture = XRenderCreatePicture(drw->dpy, drw->drawable, XRenderFindVisualFormat(drw->dpy, DefaultVisual(drw->dpy, drw->screen)), 0, NULL);
with
drw->picture = XRenderCreatePicture(drw->dpy, drw->drawable, XRenderFindVisualFormat(drw->dpy, drw->visual), 0, NULL);