summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.mk10
-rw-r--r--dev.c15
-rw-r--r--dwm.116
-rw-r--r--dwm.h4
-rw-r--r--dwm.html4
-rw-r--r--main.c34
6 files changed, 58 insertions, 25 deletions
diff --git a/config.mk b/config.mk
index ed58c1f..f32f80e 100644
--- a/config.mk
+++ b/config.mk
@@ -14,12 +14,12 @@ VERSION = 0.0
14LIBS = -L${PREFIX}/lib -L/usr/lib -lc -L${X11LIB} -lX11 14LIBS = -L${PREFIX}/lib -L/usr/lib -lc -L${X11LIB} -lX11
15 15
16# Linux/BSD 16# Linux/BSD
17CFLAGS = -Os -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \ 17#CFLAGS = -Os -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \
18 -DVERSION=\"${VERSION}\"
19LDFLAGS = ${LIBS}
20#CFLAGS = -g -Wall -O2 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \
21# -DVERSION=\"${VERSION}\" 18# -DVERSION=\"${VERSION}\"
22#LDFLAGS = -g ${LIBS} 19#LDFLAGS = ${LIBS}
20CFLAGS = -g -Wall -O2 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \
21 -DVERSION=\"${VERSION}\"
22LDFLAGS = -g ${LIBS}
23 23
24 24
25# Solaris 25# Solaris
diff --git a/dev.c b/dev.c
index 4c6e45f..7f500d9 100644
--- a/dev.c
+++ b/dev.c
@@ -27,16 +27,14 @@ static Key key[] = {
27 { Mod1Mask, XK_m, max, { 0 } }, 27 { Mod1Mask, XK_m, max, { 0 } },
28 { Mod1Mask, XK_0, view, { .i = Tscratch } }, 28 { Mod1Mask, XK_0, view, { .i = Tscratch } },
29 { Mod1Mask, XK_1, view, { .i = Tdev } }, 29 { Mod1Mask, XK_1, view, { .i = Tdev } },
30 { Mod1Mask, XK_2, view, { .i = Tirc } }, 30 { Mod1Mask, XK_2, view, { .i = Twww } },
31 { Mod1Mask, XK_3, view, { .i = Twww } }, 31 { Mod1Mask, XK_3, view, { .i = Twork } },
32 { Mod1Mask, XK_4, view, { .i = Twork } },
33 { Mod1Mask, XK_space, tiling, { 0 } }, 32 { Mod1Mask, XK_space, tiling, { 0 } },
34 { Mod1Mask|ShiftMask, XK_space, floating, { 0 } }, 33 { Mod1Mask|ShiftMask, XK_space, floating, { 0 } },
35 { Mod1Mask|ShiftMask, XK_0, ttrunc, { .i = Tscratch } }, 34 { Mod1Mask|ShiftMask, XK_0, ttrunc, { .i = Tscratch } },
36 { Mod1Mask|ShiftMask, XK_1, ttrunc, { .i = Tdev } }, 35 { Mod1Mask|ShiftMask, XK_1, ttrunc, { .i = Tdev } },
37 { Mod1Mask|ShiftMask, XK_2, ttrunc, { .i = Tirc } }, 36 { Mod1Mask|ShiftMask, XK_2, ttrunc, { .i = Twww } },
38 { Mod1Mask|ShiftMask, XK_3, ttrunc, { .i = Twww } }, 37 { Mod1Mask|ShiftMask, XK_3, ttrunc, { .i = Twork } },
39 { Mod1Mask|ShiftMask, XK_4, ttrunc, { .i = Twork } },
40 { Mod1Mask|ShiftMask, XK_c, ckill, { 0 } }, 38 { Mod1Mask|ShiftMask, XK_c, ckill, { 0 } },
41 { Mod1Mask|ShiftMask, XK_q, quit, { 0 } }, 39 { Mod1Mask|ShiftMask, XK_q, quit, { 0 } },
42 { Mod1Mask|ShiftMask, XK_Return, spawn, { .argv = term } }, 40 { Mod1Mask|ShiftMask, XK_Return, spawn, { .argv = term } },
@@ -44,9 +42,8 @@ static Key key[] = {
44 { Mod1Mask|ShiftMask, XK_l, spawn, { .argv = xlock } }, 42 { Mod1Mask|ShiftMask, XK_l, spawn, { .argv = xlock } },
45 { ControlMask, XK_0, tappend, { .i = Tscratch } }, 43 { ControlMask, XK_0, tappend, { .i = Tscratch } },
46 { ControlMask, XK_1, tappend, { .i = Tdev } }, 44 { ControlMask, XK_1, tappend, { .i = Tdev } },
47 { ControlMask, XK_2, tappend, { .i = Tirc } }, 45 { ControlMask, XK_2, tappend, { .i = Twww } },
48 { ControlMask, XK_3, tappend, { .i = Twww } }, 46 { ControlMask, XK_3, tappend, { .i = Twork } },
49 { ControlMask, XK_4, tappend, { .i = Twork } },
50}; 47};
51 48
52/********** CUSTOMIZE **********/ 49/********** CUSTOMIZE **********/
diff --git a/dwm.1 b/dwm.1
index 95a5d3a..9c63b29 100644
--- a/dwm.1
+++ b/dwm.1
@@ -81,4 +81,18 @@ Append
81.B nth 81.B nth
82tag to cureent 82tag to cureent
83.B window 83.B window
84 84.SS Default Mouse Bindings
85.TP
86.B Mod1-Button1
87Moves current
88.B window
89while dragging
90.TP
91.B Mod1-Button2
92Lowers current
93.B window
94.TP
95.B Mod1-Button3
96Resizes current
97.B window
98while dragging
diff --git a/dwm.h b/dwm.h
index 5d7ff1a..29aa6a2 100644
--- a/dwm.h
+++ b/dwm.h
@@ -9,13 +9,13 @@
9 9
10#define FONT "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*" 10#define FONT "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*"
11#define BGCOLOR "#666699" 11#define BGCOLOR "#666699"
12#define FGCOLOR "#ffffff" 12#define FGCOLOR "#eeeeee"
13#define BORDERCOLOR "#9999CC" 13#define BORDERCOLOR "#9999CC"
14#define MASTERW 52 /* percent */ 14#define MASTERW 52 /* percent */
15#define WM_PROTOCOL_DELWIN 1 15#define WM_PROTOCOL_DELWIN 1
16 16
17/* tags */ 17/* tags */
18enum { Tscratch, Tdev, Tirc, Twww, Twork, TLast }; 18enum { Tscratch, Tdev, Twww, Twork, TLast };
19 19
20/********** CUSTOMIZE **********/ 20/********** CUSTOMIZE **********/
21 21
diff --git a/dwm.html b/dwm.html
index 2efdebd..7e39f15 100644
--- a/dwm.html
+++ b/dwm.html
@@ -69,7 +69,7 @@
69 clients. 69 clients.
70 </li> 70 </li>
71 <li> 71 <li>
72 dwm reads from <b>stdin</b> to print arbirary status text (like the 72 dwm reads from <b>stdin</b> to print arbitrary status text (like the
73 date, load, battery charge). That's much simpler than larsremote, 73 date, load, battery charge). That's much simpler than larsremote,
74 wmiir and what not... 74 wmiir and what not...
75 </li> 75 </li>
@@ -83,7 +83,7 @@
83 </ul> 83 </ul>
84 <h3>Screenshot</h3> 84 <h3>Screenshot</h3>
85 <p> 85 <p>
86 <a href="http://wmii.de/shots/dwm-20060713.png">Click here for a screenshot</a> (20060713) 86 <a href="http://wmii.de/shots/dwm-20060714.png">Click here for a screenshot</a> (20060714)
87 </p> 87 </p>
88 <h3>Development</h3> 88 <h3>Development</h3>
89 <p> 89 <p>
diff --git a/main.c b/main.c
index 3d3e896..bfc63b1 100644
--- a/main.c
+++ b/main.c
@@ -3,10 +3,12 @@
3 * See LICENSE file for license details. 3 * See LICENSE file for license details.
4 */ 4 */
5 5
6#include <errno.h>
6#include <stdarg.h> 7#include <stdarg.h>
7#include <stdio.h> 8#include <stdio.h>
8#include <stdlib.h> 9#include <stdlib.h>
9#include <string.h> 10#include <string.h>
11#include <unistd.h>
10 12
11#include <X11/cursorfont.h> 13#include <X11/cursorfont.h>
12#include <X11/Xatom.h> 14#include <X11/Xatom.h>
@@ -19,7 +21,6 @@
19char *tags[TLast] = { 21char *tags[TLast] = {
20 [Tscratch] = "scratch", 22 [Tscratch] = "scratch",
21 [Tdev] = "dev", 23 [Tdev] = "dev",
22 [Tirc] = "irc",
23 [Twww] = "www", 24 [Twww] = "www",
24 [Twork] = "work", 25 [Twork] = "work",
25}; 26};
@@ -185,13 +186,13 @@ quit(Arg *arg)
185int 186int
186main(int argc, char *argv[]) 187main(int argc, char *argv[])
187{ 188{
188 int i; 189 int i, n;
190 fd_set rd;
189 XSetWindowAttributes wa; 191 XSetWindowAttributes wa;
190 unsigned int mask; 192 unsigned int mask;
191 Window w; 193 Window w;
192 XEvent ev; 194 XEvent ev;
193 195
194 /* command line args */
195 for(i = 1; (i < argc) && (argv[i][0] == '-'); i++) { 196 for(i = 1; (i < argc) && (argv[i][0] == '-'); i++) {
196 switch (argv[i][1]) { 197 switch (argv[i][1]) {
197 case 'v': 198 case 'v':
@@ -278,10 +279,31 @@ main(int argc, char *argv[])
278 scan_wins(); 279 scan_wins();
279 draw_bar(); 280 draw_bar();
280 281
282 /* main event loop, reads status text from stdin as well */
281 while(running) { 283 while(running) {
282 XNextEvent(dpy, &ev); 284 FD_ZERO(&rd);
283 if(handler[ev.type]) 285 FD_SET(0, &rd);
284 (handler[ev.type])(&ev); /* call handler */ 286 FD_SET(ConnectionNumber(dpy), &rd);
287
288 i = select(ConnectionNumber(dpy) + 1, &rd, 0, 0, 0);
289 if(i == -1 && errno == EINTR)
290 continue;
291 if(i < 0)
292 error("select failed\n");
293 else if(i > 0) {
294 if(FD_ISSET(ConnectionNumber(dpy), &rd) && XPending(dpy) > 0) {
295 XNextEvent(dpy, &ev);
296 if(handler[ev.type])
297 (handler[ev.type])(&ev); /* call handler */
298 }
299 if(FD_ISSET(0, &rd)) {
300 i = n = 0;
301 while((i = getchar()) != '\n' && n < sizeof(stext) - 1)
302 stext[n++] = i;
303 stext[n] = 0;
304 draw_bar();
305 }
306 }
285 } 307 }
286 308
287 cleanup(); 309 cleanup();