diff --git a/config.h b/config.h index e1a38e4..1d16182 100644 --- a/config.h +++ b/config.h @@ -113,16 +113,33 @@ /* List of window classes to spawn as sticky; * Class values for currently open windows are conveniently shown in the last * column of the 'xshove' command given with no arguments. + * Can be partial strings. * Remember the backslash at the end of non-terminating lines! */ #define AUTOSTICK {\ - "XOsview", \ - "XClock", \ - 0 \ + "XOsview", \ + "XClock", \ + 0 \ +} + +/* List of terminal window classes -- include your favorite terminal here, + * and remove those you don't use. Can be partial strings. + * This array is required. Remember the backslash at the end of non- + * terminating lines! + */ + +#define TERMINALS {\ + "term", \ + "Term", \ + "xvt", \ + "Alacritty", \ + "onsole", \ + 0 \ } /* List of window classes to REQUIRE window sweeping when spawning; + * Can be partial strings. * Remember the backslash at the end of non-terminating lines! */ diff --git a/fns.h b/fns.h index 7e88fa1..ab65645 100644 --- a/fns.h +++ b/fns.h @@ -61,6 +61,7 @@ void setlabel(); void getproto(); void gettrans(); int shouldalwaysdraw(Client* c); +int isterminalwindow(Client* c); /* key.c */ void keypress(); diff --git a/manage.c b/manage.c index 1e2fa8d..45533fa 100644 --- a/manage.c +++ b/manage.c @@ -50,9 +50,7 @@ int manage(Client* c, int mapped) { c->is9term = 0; #endif if (isNew) { - c->is9term = strstr(c->class, "term") || strstr(c->class, "Term") || - strstr(c->class, "urxvt") || strstr(c->class, "URxvt") || - strstr(c->class, "onsole") || strstr(c->class, "Alacritty"); + c->is9term = isterminalwindow(c); isNew = 0; } } else { @@ -573,3 +571,16 @@ int shouldalwaysdraw(Client* c) { return 0; } #endif + +int isterminalwindow(Client* c) { + static char* termnames[] = TERMINALS; + char** t = termnames; + + while (*t) { + if (c && c->class && strstr(c->class, *t)) { + return 1; + } + ++t; + } + return 0; +}