config, fns, manage: terminal classes in config instead of hardcoded in manage()
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmCHej4ACgkQO3+8IhRO Y5jgjw//QDa2OvupVBpEvf88IGZrZVmFXBkmBZixEYO8OYNO01aMHRRK6t/8UMu/ gksEgWtHugNBk3fYi/3ghPdg2xHae38t6aPD3tSK0OzkDrh3lG1B636Fk82vvwi4 VZg3x8AZ05LmgMYxAWzwTx2AopqW81LDVlaCtApSnNQQckFQxyJG+vbcTbAfDmrC 2sOtIudzaZ4moQbudc12576zUJ1mja3nC3l+E0a8tSXWzB2TlsXofucFRQ73WHJi RPewmp0AIHfBjtWpMGgzPq3htKfTMRzSVhJAIsN7LOZrEFywntP+o61c8hursy4j m47n/qpbpm4v+xp5iWHO7C8/Uw4Iw5s4y4/fERfDEGvaQAbXQYNVJD48aUteiDZn 6p+PuxBU8PqXzUQZfUdsbllkcTcA7bwSRXioOECf86WWQTqeA5JH2rAtMkk/EOUk JD32A4IJFhZgaBmzmV1y4lTn2rMOLPGooGRxQli/bV8JXckMYhjwze7vW6isdSqn anHG+Z+oa1JSkq/J2D/wrpkRUhonC4K9vdTPdgqLkB+GEEIxsl9D8BeGOunbr0So EtWMcrlGUoliFTBjnRQGST7BQxzoSa92wm+tY48D1TQvxUqj00R6ystMm19b5h3I Xy6mKsxMQRpe3RNglKp73A7ZV7xGYY8nIBv+6HQIJvGFQlopI2g= =2FhQ -----END PGP SIGNATURE-----
M
config.h
→
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! */
M
manage.c
→
manage.c
@@ -50,9 +50,7 @@ #else
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 @@ }
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; +}