all repos — slstatus @ b650c438f0dc049d98e339e66eeffd7650774a5d

my build of slstatus (tools.suckless.org/slstatus/)

removed setstatus() && simplified main()
Ali H. Fardan raiz@firemail.cc
Fri, 02 Sep 2016 22:13:58 +0300
commit

b650c438f0dc049d98e339e66eeffd7650774a5d

parent

d1ae2e785d26d944fb4b228c2e025528cd8b780b

1 files changed, 2 insertions(+), 16 deletions(-)

jump to
M slstatus.cslstatus.c

@@ -33,7 +33,6 @@ const char *format;

const char *args; }; -static void setstatus(const char *); static char *smprintf(const char *, ...); static char *battery_perc(const char *); static char *cpu_perc(void);

@@ -63,14 +62,6 @@

static Display *dpy; #include "config.h" - -static void -setstatus(const char *str) -{ - /* set WM_NAME via X11 */ - XStoreName(dpy, DefaultRootWindow(dpy), str); - XSync(dpy, False); -} static char * smprintf(const char *fmt, ...)

@@ -625,10 +616,6 @@ char *res, *element;

struct arg argument; dpy = XOpenDisplay(0x0); - if (!dpy) { - fprintf(stderr, "Cannot open display!\n"); - exit(1); - } for (;;) { memset(status_string, 0, sizeof(status_string));

@@ -648,7 +635,8 @@ free(res);

free(element); } - setstatus(status_string); + XStoreName(dpy, DefaultRootWindow(dpy), status_string); + XSync(dpy, False); sleep(UPDATE_INTERVAL -1); }

@@ -657,8 +645,6 @@ /*

* TODO: find out a way to exit successfully * to prevent memory leaks */ -/* XCloseDisplay(dpy); return 0; -*/ }