Detect Polybar
This commit is contained in:
parent
30bc46a7d0
commit
9ff7725016
40
src/dwm.c
40
src/dwm.c
|
@ -209,6 +209,7 @@ static void updatesizehints(Client *c);
|
||||||
static void updatetitle(Client *c);
|
static void updatetitle(Client *c);
|
||||||
static void updatewindowtype(Client *c);
|
static void updatewindowtype(Client *c);
|
||||||
static void updatewmhints(Client *c);
|
static void updatewmhints(Client *c);
|
||||||
|
static bool winpolybar(Window w);
|
||||||
static Client *wintoclient(Window w);
|
static Client *wintoclient(Window w);
|
||||||
static Monitor *wintomon(Window w);
|
static Monitor *wintomon(Window w);
|
||||||
static void wmcheckwin_create();
|
static void wmcheckwin_create();
|
||||||
|
@ -1731,7 +1732,9 @@ void scan()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (winpolybar(wins[i])) {
|
||||||
|
// do nothing
|
||||||
|
} else if (
|
||||||
wa.map_state == IsViewable
|
wa.map_state == IsViewable
|
||||||
||
|
||
|
||||||
getstate(wins[i]) == IconicState
|
getstate(wins[i]) == IconicState
|
||||||
|
@ -2278,6 +2281,41 @@ Client *wintoclient(Window w)
|
||||||
return NULL;
|
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)
|
Monitor *wintomon(Window w)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
|
|
@ -244,7 +244,9 @@ void on_map_request(XEvent *e)
|
||||||
if (!XGetWindowAttributes(xbase->x_display, ev->window, &wa)) return;
|
if (!XGetWindowAttributes(xbase->x_display, ev->window, &wa)) return;
|
||||||
if (wa.override_redirect) 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);
|
manage(ev->window, &wa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue