config, fns, manage: terminal classes in config instead of hardcoded in manage()
This commit is contained in:
parent
a92efcd49f
commit
2a3fb33866
3 changed files with 35 additions and 6 deletions
17
config.h
17
config.h
|
@ -113,6 +113,7 @@
|
||||||
/* List of window classes to spawn as sticky;
|
/* List of window classes to spawn as sticky;
|
||||||
* Class values for currently open windows are conveniently shown in the last
|
* Class values for currently open windows are conveniently shown in the last
|
||||||
* column of the 'xshove' command given with no arguments.
|
* column of the 'xshove' command given with no arguments.
|
||||||
|
* Can be partial strings.
|
||||||
* Remember the backslash at the end of non-terminating lines!
|
* Remember the backslash at the end of non-terminating lines!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -122,7 +123,23 @@
|
||||||
0 \
|
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;
|
/* List of window classes to REQUIRE window sweeping when spawning;
|
||||||
|
* Can be partial strings.
|
||||||
* Remember the backslash at the end of non-terminating lines!
|
* Remember the backslash at the end of non-terminating lines!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
1
fns.h
1
fns.h
|
@ -61,6 +61,7 @@ void setlabel();
|
||||||
void getproto();
|
void getproto();
|
||||||
void gettrans();
|
void gettrans();
|
||||||
int shouldalwaysdraw(Client* c);
|
int shouldalwaysdraw(Client* c);
|
||||||
|
int isterminalwindow(Client* c);
|
||||||
|
|
||||||
/* key.c */
|
/* key.c */
|
||||||
void keypress();
|
void keypress();
|
||||||
|
|
17
manage.c
17
manage.c
|
@ -50,9 +50,7 @@ int manage(Client* c, int mapped) {
|
||||||
c->is9term = 0;
|
c->is9term = 0;
|
||||||
#endif
|
#endif
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
c->is9term = strstr(c->class, "term") || strstr(c->class, "Term") ||
|
c->is9term = isterminalwindow(c);
|
||||||
strstr(c->class, "urxvt") || strstr(c->class, "URxvt") ||
|
|
||||||
strstr(c->class, "onsole") || strstr(c->class, "Alacritty");
|
|
||||||
isNew = 0;
|
isNew = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -573,3 +571,16 @@ int shouldalwaysdraw(Client* c) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#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;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue