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
23
config.h
23
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!
|
||||
*/
|
||||
|
||||
|
|
1
fns.h
1
fns.h
|
@ -61,6 +61,7 @@ void setlabel();
|
|||
void getproto();
|
||||
void gettrans();
|
||||
int shouldalwaysdraw(Client* c);
|
||||
int isterminalwindow(Client* c);
|
||||
|
||||
/* key.c */
|
||||
void keypress();
|
||||
|
|
17
manage.c
17
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue