ztatus

[discontinued] Status bar for dwm, and simple notification daemon.
git clone https://noxz.tech/git/ztatus.git
ztatus

commit: a6aaca3075cb345587a524bbd50c5c89f8603785
parent: 397aa2f918a16b6fd373469feee831366c4740e1
author: Chris Noxz <chris@noxz.tech>
date:   Thu, 11 May 2023 18:57:57 +0200
output to stdout instead of xroot
Mconfig.mk6------
Mztatus.c11++---------
2 files changed, 2 insertions(+), 15 deletions(-)
diff --git a/config.mk b/config.mk
@@ -4,12 +4,6 @@ VERSION = 0.9
 # paths
 PREFIX = /usr/local
 MANPREFIX = $(PREFIX)/share/man
-X11INC = /usr/X11R6/include
-X11LIB = /usr/X11R6/lib
-
-# includes and libs
-INCS = -I$(X11INC)
-LIBS = -L$(X11LIB) -lX11
 
 # flags
 CFLAGS = -Wall -pedantic -std=c99
diff --git a/ztatus.c b/ztatus.c
@@ -1,4 +1,3 @@
-#include <X11/Xlib.h>
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -29,7 +28,6 @@ static void set_status(const char*);
 static void sigint_handler(int);
 
 /* global variables */
-static Display *dpy;
 static char *last_line;
 static int delay_time = 0;
 static int running = 0;
@@ -74,8 +72,6 @@ run(void)
 		return die("error: cannot create fifo '%s'\n", FIFO_PATH);
 	if ((fifofd = open(FIFO_PATH, O_RDWR | O_NONBLOCK)) < 0)
 		return die("error: cannot open fifo '%s'\n", FIFO_PATH);
-	if (!(dpy = XOpenDisplay(NULL)))
-		return die("error: cannot open display\n", FIFO_PATH);
 	if ((status_line = malloc(STATUS_LENGTH)) == NULL)
 		return die("error: failed to allocate memory\n", FIFO_PATH);
 	if ((last_line = calloc(STATUS_LENGTH, sizeof(char))) == NULL)
@@ -120,7 +116,6 @@ run(void)
 	/* free up resources when done */
 	free(status_line);
 	free(last_line);
-	XCloseDisplay(dpy);
 	if (fifofd >= 0)
 		unlink(FIFO_PATH);
 
@@ -273,10 +268,8 @@ render_time(char *str)
 
 void
 set_status(const char *line) {
-	if (strcmp(line, last_line)) {
-		XStoreName(dpy, DefaultRootWindow(dpy), line);
-		XSync(dpy, False);
-	}
+	if (strcmp(line, last_line))
+		puts(line);
 	strcpy(last_line, line);
 }