status

statusbar program for dwm
git clone anongit@rnpnr.xyz:status.git
Log | Files | Refs | Feed | README | LICENSE

Commit: 326fe81c65886bb0422d39b7876f3d09f5241a73
Parent: 017627677b9712b15e8b78ac9d1b231f82aa1572
Author: opask
Date:   Tue, 13 Nov 2018 09:57:54 -0700

initial config.h support

Diffstat:
MMakefile | 5+++++
Aconfig.def.h | 5+++++
Mstatus.c | 6++++--
3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile @@ -5,9 +5,14 @@ OBJ = $(SRC:.c=.o) all: status +config.h: + cp config.def.h config.h + .c.o: $(CC) $(CFLAGS) -c $< +$(OBJ): config.h + status: $(OBJ) $(CC) -o $@ $(OBJ) $(LDFLAGS) diff --git a/config.def.h b/config.def.h @@ -0,0 +1,5 @@ +/* host for connecting to MPD, set to NULL for the MPD_HOST env variable */ +static const char *mpdhost = "localhost"; + +/* datetime format */ +static const char *timefmt = "%R"; diff --git a/status.c b/status.c @@ -10,6 +10,8 @@ #include <mpd/client.h> #include <X11/Xlib.h> +#include "config.h" + static int done = 0; static char buf[1024]; @@ -109,7 +111,7 @@ mpd(enum mpd_tag_type type) struct mpd_song *song = NULL; struct mpd_status *status = NULL; - conn = mpd_connection_new("localhost", 0, 600); + conn = mpd_connection_new(mpdhost, 0, 600); if (!conn || mpd_connection_get_error(conn)) return smprintf(""); @@ -154,7 +156,7 @@ main(void) die("XOpenDisplay: can't open display\n"); for (; !done; sleep(1)) { - time = gettime("%Y年%m月%d日 ♦ %R"); + time = gettime(timefmt); song = mpd(MPD_TAG_TITLE); artist = mpd(MPD_TAG_ARTIST); vol = alsavol();