dwm-meillo
changeset 59:5d4653de9a1c
implemented dwm reading status text from stdin
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Fri, 14 Jul 2006 11:57:33 +0200 |
parents | 1269bd127551 |
children | 24f9c674d03f |
files | config.mk dev.c dwm.1 dwm.h dwm.html main.c |
diffstat | 6 files changed, 58 insertions(+), 25 deletions(-) [+] |
line diff
1.1 --- a/config.mk Fri Jul 14 10:34:07 2006 +0200 1.2 +++ b/config.mk Fri Jul 14 11:57:33 2006 +0200 1.3 @@ -14,12 +14,12 @@ 1.4 LIBS = -L${PREFIX}/lib -L/usr/lib -lc -L${X11LIB} -lX11 1.5 1.6 # Linux/BSD 1.7 -CFLAGS = -Os -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \ 1.8 +#CFLAGS = -Os -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \ 1.9 +# -DVERSION=\"${VERSION}\" 1.10 +#LDFLAGS = ${LIBS} 1.11 +CFLAGS = -g -Wall -O2 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \ 1.12 -DVERSION=\"${VERSION}\" 1.13 -LDFLAGS = ${LIBS} 1.14 -#CFLAGS = -g -Wall -O2 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \ 1.15 -# -DVERSION=\"${VERSION}\" 1.16 -#LDFLAGS = -g ${LIBS} 1.17 +LDFLAGS = -g ${LIBS} 1.18 1.19 1.20 # Solaris
2.1 --- a/dev.c Fri Jul 14 10:34:07 2006 +0200 2.2 +++ b/dev.c Fri Jul 14 11:57:33 2006 +0200 2.3 @@ -27,16 +27,14 @@ 2.4 { Mod1Mask, XK_m, max, { 0 } }, 2.5 { Mod1Mask, XK_0, view, { .i = Tscratch } }, 2.6 { Mod1Mask, XK_1, view, { .i = Tdev } }, 2.7 - { Mod1Mask, XK_2, view, { .i = Tirc } }, 2.8 - { Mod1Mask, XK_3, view, { .i = Twww } }, 2.9 - { Mod1Mask, XK_4, view, { .i = Twork } }, 2.10 + { Mod1Mask, XK_2, view, { .i = Twww } }, 2.11 + { Mod1Mask, XK_3, view, { .i = Twork } }, 2.12 { Mod1Mask, XK_space, tiling, { 0 } }, 2.13 { Mod1Mask|ShiftMask, XK_space, floating, { 0 } }, 2.14 { Mod1Mask|ShiftMask, XK_0, ttrunc, { .i = Tscratch } }, 2.15 { Mod1Mask|ShiftMask, XK_1, ttrunc, { .i = Tdev } }, 2.16 - { Mod1Mask|ShiftMask, XK_2, ttrunc, { .i = Tirc } }, 2.17 - { Mod1Mask|ShiftMask, XK_3, ttrunc, { .i = Twww } }, 2.18 - { Mod1Mask|ShiftMask, XK_4, ttrunc, { .i = Twork } }, 2.19 + { Mod1Mask|ShiftMask, XK_2, ttrunc, { .i = Twww } }, 2.20 + { Mod1Mask|ShiftMask, XK_3, ttrunc, { .i = Twork } }, 2.21 { Mod1Mask|ShiftMask, XK_c, ckill, { 0 } }, 2.22 { Mod1Mask|ShiftMask, XK_q, quit, { 0 } }, 2.23 { Mod1Mask|ShiftMask, XK_Return, spawn, { .argv = term } }, 2.24 @@ -44,9 +42,8 @@ 2.25 { Mod1Mask|ShiftMask, XK_l, spawn, { .argv = xlock } }, 2.26 { ControlMask, XK_0, tappend, { .i = Tscratch } }, 2.27 { ControlMask, XK_1, tappend, { .i = Tdev } }, 2.28 - { ControlMask, XK_2, tappend, { .i = Tirc } }, 2.29 - { ControlMask, XK_3, tappend, { .i = Twww } }, 2.30 - { ControlMask, XK_4, tappend, { .i = Twork } }, 2.31 + { ControlMask, XK_2, tappend, { .i = Twww } }, 2.32 + { ControlMask, XK_3, tappend, { .i = Twork } }, 2.33 }; 2.34 2.35 /********** CUSTOMIZE **********/
3.1 --- a/dwm.1 Fri Jul 14 10:34:07 2006 +0200 3.2 +++ b/dwm.1 Fri Jul 14 11:57:33 2006 +0200 3.3 @@ -81,4 +81,18 @@ 3.4 .B nth 3.5 tag to cureent 3.6 .B window 3.7 - 3.8 +.SS Default Mouse Bindings 3.9 +.TP 3.10 +.B Mod1-Button1 3.11 +Moves current 3.12 +.B window 3.13 +while dragging 3.14 +.TP 3.15 +.B Mod1-Button2 3.16 +Lowers current 3.17 +.B window 3.18 +.TP 3.19 +.B Mod1-Button3 3.20 +Resizes current 3.21 +.B window 3.22 +while dragging
4.1 --- a/dwm.h Fri Jul 14 10:34:07 2006 +0200 4.2 +++ b/dwm.h Fri Jul 14 11:57:33 2006 +0200 4.3 @@ -9,13 +9,13 @@ 4.4 4.5 #define FONT "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*" 4.6 #define BGCOLOR "#666699" 4.7 -#define FGCOLOR "#ffffff" 4.8 +#define FGCOLOR "#eeeeee" 4.9 #define BORDERCOLOR "#9999CC" 4.10 #define MASTERW 52 /* percent */ 4.11 #define WM_PROTOCOL_DELWIN 1 4.12 4.13 /* tags */ 4.14 -enum { Tscratch, Tdev, Tirc, Twww, Twork, TLast }; 4.15 +enum { Tscratch, Tdev, Twww, Twork, TLast }; 4.16 4.17 /********** CUSTOMIZE **********/ 4.18
5.1 --- a/dwm.html Fri Jul 14 10:34:07 2006 +0200 5.2 +++ b/dwm.html Fri Jul 14 11:57:33 2006 +0200 5.3 @@ -69,7 +69,7 @@ 5.4 clients. 5.5 </li> 5.6 <li> 5.7 - dwm reads from <b>stdin</b> to print arbirary status text (like the 5.8 + dwm reads from <b>stdin</b> to print arbitrary status text (like the 5.9 date, load, battery charge). That's much simpler than larsremote, 5.10 wmiir and what not... 5.11 </li> 5.12 @@ -83,7 +83,7 @@ 5.13 </ul> 5.14 <h3>Screenshot</h3> 5.15 <p> 5.16 - <a href="http://wmii.de/shots/dwm-20060713.png">Click here for a screenshot</a> (20060713) 5.17 + <a href="http://wmii.de/shots/dwm-20060714.png">Click here for a screenshot</a> (20060714) 5.18 </p> 5.19 <h3>Development</h3> 5.20 <p>
6.1 --- a/main.c Fri Jul 14 10:34:07 2006 +0200 6.2 +++ b/main.c Fri Jul 14 11:57:33 2006 +0200 6.3 @@ -3,10 +3,12 @@ 6.4 * See LICENSE file for license details. 6.5 */ 6.6 6.7 +#include <errno.h> 6.8 #include <stdarg.h> 6.9 #include <stdio.h> 6.10 #include <stdlib.h> 6.11 #include <string.h> 6.12 +#include <unistd.h> 6.13 6.14 #include <X11/cursorfont.h> 6.15 #include <X11/Xatom.h> 6.16 @@ -19,7 +21,6 @@ 6.17 char *tags[TLast] = { 6.18 [Tscratch] = "scratch", 6.19 [Tdev] = "dev", 6.20 - [Tirc] = "irc", 6.21 [Twww] = "www", 6.22 [Twork] = "work", 6.23 }; 6.24 @@ -185,13 +186,13 @@ 6.25 int 6.26 main(int argc, char *argv[]) 6.27 { 6.28 - int i; 6.29 + int i, n; 6.30 + fd_set rd; 6.31 XSetWindowAttributes wa; 6.32 unsigned int mask; 6.33 Window w; 6.34 XEvent ev; 6.35 6.36 - /* command line args */ 6.37 for(i = 1; (i < argc) && (argv[i][0] == '-'); i++) { 6.38 switch (argv[i][1]) { 6.39 case 'v': 6.40 @@ -278,10 +279,31 @@ 6.41 scan_wins(); 6.42 draw_bar(); 6.43 6.44 + /* main event loop, reads status text from stdin as well */ 6.45 while(running) { 6.46 - XNextEvent(dpy, &ev); 6.47 - if(handler[ev.type]) 6.48 - (handler[ev.type])(&ev); /* call handler */ 6.49 + FD_ZERO(&rd); 6.50 + FD_SET(0, &rd); 6.51 + FD_SET(ConnectionNumber(dpy), &rd); 6.52 + 6.53 + i = select(ConnectionNumber(dpy) + 1, &rd, 0, 0, 0); 6.54 + if(i == -1 && errno == EINTR) 6.55 + continue; 6.56 + if(i < 0) 6.57 + error("select failed\n"); 6.58 + else if(i > 0) { 6.59 + if(FD_ISSET(ConnectionNumber(dpy), &rd) && XPending(dpy) > 0) { 6.60 + XNextEvent(dpy, &ev); 6.61 + if(handler[ev.type]) 6.62 + (handler[ev.type])(&ev); /* call handler */ 6.63 + } 6.64 + if(FD_ISSET(0, &rd)) { 6.65 + i = n = 0; 6.66 + while((i = getchar()) != '\n' && n < sizeof(stext) - 1) 6.67 + stext[n++] = i; 6.68 + stext[n] = 0; 6.69 + draw_bar(); 6.70 + } 6.71 + } 6.72 } 6.73 6.74 cleanup();