Code

xterm_title: simplify if/else chains
authorMax Kellermann <max.kellermann@gmail.com>
Mon, 20 Mar 2017 16:06:47 +0000 (17:06 +0100)
committerMax Kellermann <max.kellermann@gmail.com>
Mon, 20 Mar 2017 16:06:47 +0000 (17:06 +0100)
src/xterm_title.c

index 0e993cf3b2d022f163103b787c2c4843f9d15e3f..248cfa8c5d6a0f7291309e854eedd7c5dd936b29 100644 (file)
@@ -28,11 +28,14 @@ set_xterm_title(const char *title)
        /* the current xterm title exists under the WM_NAME property */
        /* and can be retrieved with xprop -id $WINDOWID */
 
-       if (options.enable_xterm_title) {
-               if (g_getenv("WINDOWID")) {
-                       printf("\033]0;%s\033\\", title);
-                       fflush(stdout);
-               } else
-                       options.enable_xterm_title = FALSE;
+       if (!options.enable_xterm_title)
+               return;
+
+       if (g_getenv("WINDOWID") == NULL) {
+               options.enable_xterm_title = FALSE;
+               return;
        }
+
+       printf("\033]0;%s\033\\", title);
+       fflush(stdout);
 }