config, fns, manage: terminal classes in config instead of hardcoded in manage()

This commit is contained in:
Iris Lightshard 2021-04-26 22:43:10 -04:00
parent a92efcd49f
commit 2a3fb33866
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
3 changed files with 35 additions and 6 deletions

View file

@ -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!
*/

1
fns.h
View file

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

View file

@ -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;
}