manage.c, config.h, fns.h: implement ALWAYDRAW option

This commit is contained in:
Iris Lightshard 2021-03-10 22:03:49 -05:00
parent a2d3fc7ffc
commit f03abb164a
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
3 changed files with 20 additions and 1 deletions

View file

@ -127,7 +127,6 @@
*/ */
#define ALWAYSDRAW {\ #define ALWAYSDRAW {\
"cmapcube", \
0 \ 0 \
} }

1
fns.h
View file

@ -60,6 +60,7 @@ void setstate();
void setlabel(); void setlabel();
void getproto(); void getproto();
void gettrans(); void gettrans();
int shouldalwaysdraw(Client* c);
/* key.c */ /* key.c */
void keypress(); void keypress();

View file

@ -44,7 +44,11 @@ int manage(Client* c, int mapped) {
if (XGetClassHint(dpy, c->window, &class) != 0) { /* ``Success'' */ if (XGetClassHint(dpy, c->window, &class) != 0) { /* ``Success'' */
c->instance = class.res_name; c->instance = class.res_name;
c->class = class.res_class; c->class = class.res_class;
#ifdef ALWAYSDRAW
c->is9term = shouldalwaysdraw(c);
#else
c->is9term = 0; c->is9term = 0;
#endif
if (isNew) { if (isNew) {
c->is9term = strstr(c->class, "term") || strstr(c->class, "Term") || c->is9term = strstr(c->class, "term") || strstr(c->class, "Term") ||
strstr(c->class, "urxvt") || strstr(c->class, "URxvt") || strstr(c->class, "urxvt") || strstr(c->class, "URxvt") ||
@ -554,3 +558,18 @@ void getproto(Client* c) {
XFree((char*)p); XFree((char*)p);
} }
#ifdef ALWAYSDRAW
int shouldalwaysdraw(Client* c) {
static char* alwaysdraw[] = ALWAYSDRAW;
char** a = alwaysdraw;
while (*a) {
if (c && c->class && strstr(c->class, *a)) {
return 1;
}
++a;
}
return 0;
}
#endif