]> git.sur5r.net Git - i3/i3status/blobdiff - src/auto_detect_format.c
Makefile: use .SILENT and support V=1 for verbose builds
[i3/i3status] / src / auto_detect_format.c
index 7c4d65d6adee54697a8a752a57fb7554fb104a50..524e2e9d9b40a0737a2c45a5cd5eaca92b12965f 100644 (file)
  * We then check whether the pipe target’s name is known and chose the format.
  *
  */
-char *auto_detect_format() {
+char *auto_detect_format(void) {
+    /* If stdout is a tty, we output directly to a terminal. */
+    if (isatty(STDOUT_FILENO)) {
+        return "term";
+    }
+
     pid_t myppid = getppid();
     pid_t mypid = getpid();
 
@@ -139,7 +144,7 @@ char *auto_detect_format() {
         else if (strcasecmp(name, "xmobar") == 0)
             newfmt = "xmobar";
 
-        if (newfmt && format) {
+        if (newfmt && format && strcmp(newfmt, format) != 0) {
             fprintf(stderr, "i3status: cannot auto-configure, situation ambiguous (format \"%s\" *and* \"%s\" detected)\n", newfmt, format);
             format = NULL;
             break;