I just upgraded to the new DWM and "had" to apply the stdin patch to keep
the behaviour I'm used to :) It didn't quite apply against tip, so attached
are my changes to make it apply, if anyone's interested.
--
Stephen Paul Weber, @singpolyma
See <http://singpolyma.net> for how I prefer to be contacted
edition right joseph
commit 53d83190f95cbce4fa949328d82796ee97ec9761
Author: Stephen Paul Weber <singpol...@singpolyma.net>
Date: Sat Nov 12 23:58:27 2011 -0500
Added http://dwm.suckless.org/patches/stdin
diff --git a/config.def.h b/config.def.h
index 77ff358..2c02160 100644
--- a/config.def.h
+++ b/config.def.h
@@ -12,6 +12,7 @@ static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */
static const Bool showbar = True; /* False means no bar */
static const Bool topbar = True; /* False means bottom bar */
+static Bool readin = True; /* False means do not read stdin */
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
diff --git a/dwm.c b/dwm.c
index fd6f04d..aa748f4 100644
--- a/dwm.c
+++ b/dwm.c
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <sys/select.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <X11/cursorfont.h>
@@ -239,7 +240,6 @@ static void updatebarpos(Monitor *m);
static void updatebars(void);
static void updatenumlockmask(void);
static void updatesizehints(Client *c);
-static void updatestatus(void);
static void updatewindowtype(Client *c);
static void updatetitle(Client *c);
static void updatewmhints(Client *c);
@@ -1276,9 +1276,7 @@ propertynotify(XEvent *e) {
Window trans;
XPropertyEvent *ev = &e->xproperty;
- if((ev->window == root) && (ev->atom == XA_WM_NAME))
- updatestatus();
- else if(ev->state == PropertyDelete)
+ if(ev->state == PropertyDelete)
return; /* ignore */
else if((c = wintoclient(ev->window))) {
switch(ev->atom) {
@@ -1420,12 +1418,61 @@ restack(Monitor *m) {
void
run(void) {
+ char *p;
+ char sbuf[sizeof stext];
+ fd_set rd;
+ int r, xfd;
+ unsigned int len, offset;
XEvent ev;
- /* main event loop */
+
+ /* main event loop, also reads status text from stdin */
XSync(dpy, False);
- while(running && !XNextEvent(dpy, &ev))
- if(handler[ev.type])
- handler[ev.type](&ev); /* call handler */
+ xfd = ConnectionNumber(dpy);
+ offset = 0;
+ len = sizeof stext - 1;
+ sbuf[len] = stext[len] = '