add dwm-setstatus.c
This commit is contained in:
parent
cd6615819e
commit
f972a39b88
5
Makefile
5
Makefile
|
@ -6,7 +6,7 @@ include config.mk
|
|||
SRC = drw.c dwm.c util.c
|
||||
OBJ = ${SRC:.c=.o}
|
||||
|
||||
all: dwm
|
||||
all: dwm dwm-setstatus
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $<
|
||||
|
@ -19,6 +19,9 @@ config.h:
|
|||
dwm: ${OBJ}
|
||||
${CC} -o $@ ${OBJ} ${LDFLAGS}
|
||||
|
||||
dwm-setstatus:
|
||||
${CC} -o $@ dwm-setstatus.c ${LDFLAGS}
|
||||
|
||||
clean:
|
||||
rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz
|
||||
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
Display * dpy = NULL;
|
||||
Window win = 0;
|
||||
size_t length = 0;
|
||||
ssize_t bytes_read = 0;
|
||||
char * input = NULL;
|
||||
|
||||
dpy = XOpenDisplay(getenv("DISPLAY"));
|
||||
if (dpy == NULL)
|
||||
{
|
||||
fprintf(stderr, "Can't open display, exiting.\n");
|
||||
exit(1);
|
||||
}
|
||||
win = DefaultRootWindow(dpy);
|
||||
|
||||
while ((bytes_read = getline(&input, &length, stdin)) != EOF)
|
||||
{
|
||||
input[strlen(input) - 1] = '\0';
|
||||
XStoreName(dpy, win, input);
|
||||
XFlush(dpy);
|
||||
}
|
||||
free(input);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue