diff --git a/src/dwm.c b/src/dwm.c index 1b0fdd6..7121840 100644 --- a/src/dwm.c +++ b/src/dwm.c @@ -209,6 +209,7 @@ static void updatesizehints(Client *c); static void updatetitle(Client *c); static void updatewindowtype(Client *c); static void updatewmhints(Client *c); +static bool winpolybar(Window w); static Client *wintoclient(Window w); static Monitor *wintomon(Window w); static void wmcheckwin_create(); @@ -1731,7 +1732,9 @@ void scan() continue; } - if ( + if (winpolybar(wins[i])) { + // do nothing + } else if ( wa.map_state == IsViewable || getstate(wins[i]) == IconicState @@ -2278,6 +2281,41 @@ Client *wintoclient(Window w) return NULL; } +bool winpolybar(const Window w) +{ + XClassHint ch = { NULL, NULL }; + bool result = true; + + if (XGetClassHint(xbase->x_display, w, &ch)) { + if ( + ch.res_class + && + strstr(ch.res_class, "Polybar") == NULL + && + strstr(ch.res_class, "polybar") == NULL + ) { + result = false; + } + + if ( + ch.res_name + && + strstr(ch.res_name, "Polybar") == NULL + && + strstr(ch.res_name, "polybar") == NULL + ) { + result = false; + } + } else { + result = false; + } + + if (ch.res_class) XFree(ch.res_class); + if (ch.res_name) XFree(ch.res_name); + + return result; +} + Monitor *wintomon(Window w) { { diff --git a/src/dwm/handlers.c b/src/dwm/handlers.c index b98370f..a10ace3 100644 --- a/src/dwm/handlers.c +++ b/src/dwm/handlers.c @@ -244,7 +244,9 @@ void on_map_request(XEvent *e) if (!XGetWindowAttributes(xbase->x_display, ev->window, &wa)) return; if (wa.override_redirect) return; - if (!wintoclient(ev->window)) { + if (winpolybar(ev->window)) { + // do nothing + } else if (!wintoclient(ev->window)) { manage(ev->window, &wa); } }