commit 5d413f0b7aa45599011a878433a23b1b1db6fcd8
parent 9151f7f9c5ca418a783725508104354110077d24
Author: sam-barr <samfbarr@outlook.com>
Date: Fri, 24 Apr 2020 21:14:51 -0500
Merge pull request #42 from allisio/terminal-fallback
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 */
}