Xinqi Bao's Git

only open and close display if output type is dwm
authorAaron Marcher <[email protected]>
Sat, 17 Sep 2016 14:53:45 +0000 (16:53 +0200)
committerAaron Marcher (drkhsh) <[email protected]>
Sat, 17 Sep 2016 14:53:45 +0000 (16:53 +0200)
slstatus.c

index e1d271f..379be53 100644 (file)
@@ -633,7 +633,9 @@ main(int argc, char *argv[])
        sigaction(SIGINT,  &act, 0);
        sigaction(SIGTERM, &act, 0);
 
        sigaction(SIGINT,  &act, 0);
        sigaction(SIGTERM, &act, 0);
 
-       dpy = XOpenDisplay(NULL);
+       if (!oflag) {
+               dpy = XOpenDisplay(NULL);
+       }
 
        while (!done) {
                status_string[0] = '\0';
 
        while (!done) {
                status_string[0] = '\0';
@@ -671,9 +673,8 @@ main(int argc, char *argv[])
 
        if (!oflag) {
                set_status(NULL);
 
        if (!oflag) {
                set_status(NULL);
+               XCloseDisplay(dpy);
        }
 
        }
 
-       XCloseDisplay(dpy);
-
        return 0;
 }
        return 0;
 }