summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2011-07-13 17:21:35 +0200
committerMichael Stapelberg <michael@stapelberg.de>2011-07-13 17:21:35 +0200
commit7728c35401cf53dc87832c9bb1b0bfe32fa1ed92 (patch)
treeb4136b384be75eec76d7176c1eaeadde82288851
parent986536e28fdb8c2cac2187f0667c6ffbb1161f8d (diff)
correctly auto-detect the output format with zsh (Thanks mist)
-rw-r--r--src/auto_detect_format.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/auto_detect_format.c b/src/auto_detect_format.c
index 2df13f5..299614a 100644
--- a/src/auto_detect_format.c
+++ b/src/auto_detect_format.c
@@ -74,6 +74,19 @@ char *auto_detect_format() {
if (!parentname)
goto out;
+ /* Some shells, for example zsh, open a pipe in a way which will make the
+ * pipe target the parent process of i3status. If we detect that, we set
+ * the format and we are done. */
+ if (strcasecmp(parentname, "i3bar") == 0)
+ format = "none";
+ else if (strcasecmp(parentname, "dzen2") == 0)
+ format = "dzen2";
+ else if (strcasecmp(parentname, "xmobar") == 0)
+ format = "xmobar";
+
+ if (format)
+ goto out;
+
rewinddir(dir);
while ((entry = readdir(dir)) != NULL) {