commit e979b841bf6ef57ffa122a2931448702982f1e32
parent 9151f7f9c5ca418a783725508104354110077d24
Author: Allis IO <0xa111510@gmail.com>
Date: Fri, 24 Apr 2020 16:14:23 -0400
Resort to fallback method if we can't get the active window (Fixes #38)
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/paleofetch.c b/paleofetch.c
@@ -313,6 +313,7 @@ char *get_terminal() {
GetProp(active);
window = (prop[3] << 24) + (prop[2] << 16) + (prop[1] << 8) + prop[0];
free(prop);
+ if(!window) goto terminal_fallback;
GetProp(class);
#undef GetProp
@@ -320,6 +321,7 @@ char *get_terminal() {
snprintf(terminal, BUF_SIZE, "%s", prop);
free(prop);
} else {
+terminal_fallback:
strncpy(terminal, getenv("TERM"), BUF_SIZE); /* fallback to old method */
}