summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--draw.c4
-rw-r--r--dwm.h38
-rw-r--r--dwm.html7
-rw-r--r--event.c35
-rw-r--r--main.c38
-rw-r--r--tag.c21
-rw-r--r--util.c4
7 files changed, 70 insertions, 77 deletions
diff --git a/draw.c b/draw.c
index ec0e964..b8cfffd 100644
--- a/draw.c
+++ b/draw.c
@@ -8,7 +8,7 @@
8#include <string.h> 8#include <string.h>
9#include <X11/Xlocale.h> 9#include <X11/Xlocale.h>
10 10
11/* static functions */ 11/* static */
12 12
13static void 13static void
14drawborder(void) 14drawborder(void)
@@ -90,7 +90,7 @@ drawtext(const char *text, Bool invert, Bool border)
90 } 90 }
91} 91}
92 92
93/* extern functions */ 93/* extern */
94 94
95void 95void
96drawall() 96drawall()
diff --git a/dwm.h b/dwm.h
index 75aa50c..de88527 100644
--- a/dwm.h
+++ b/dwm.h
@@ -37,28 +37,28 @@ union Arg {
37}; 37};
38 38
39/* atoms */ 39/* atoms */
40enum { WMProtocols, WMDelete, WMLast };
41enum { NetSupported, NetWMName, NetLast }; 40enum { NetSupported, NetWMName, NetLast };
41enum { WMProtocols, WMDelete, WMLast };
42 42
43/* cursor */ 43/* cursor */
44enum { CurNormal, CurResize, CurMove, CurInput, CurLast }; 44enum { CurNormal, CurResize, CurMove, CurLast };
45 45
46struct Fnt { 46struct Fnt {
47 XFontStruct *xfont;
48 XFontSet set;
49 int ascent; 47 int ascent;
50 int descent; 48 int descent;
51 int height; 49 int height;
50 XFontSet set;
51 XFontStruct *xfont;
52}; 52};
53 53
54struct DC { /* draw context */ 54struct DC { /* draw context */
55 GC gc;
56 Drawable drawable;
57 int x, y, w, h; 55 int x, y, w, h;
58 Fnt font;
59 unsigned long bg; 56 unsigned long bg;
60 unsigned long fg; 57 unsigned long fg;
61 unsigned long border; 58 unsigned long border;
59 Drawable drawable;
60 Fnt font;
61 GC gc;
62}; 62};
63 63
64struct Client { 64struct Client {
@@ -72,10 +72,10 @@ struct Client {
72 unsigned int border; 72 unsigned int border;
73 long flags; 73 long flags;
74 Bool isfloat; 74 Bool isfloat;
75 Window win;
76 Window title;
77 Client *next; 75 Client *next;
78 Client *revert; 76 Client *revert;
77 Window win;
78 Window title;
79}; 79};
80 80
81struct Rule { 81struct Rule {
@@ -92,20 +92,18 @@ struct Key {
92 Arg arg; 92 Arg arg;
93}; 93};
94 94
95extern Display *dpy; 95extern char *tags[TLast], stext[1024];
96extern Window root, barwin; 96extern int tsel, screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
97extern Atom wmatom[WMLast], netatom[NetLast];
98extern Cursor cursor[CurLast];
99extern Bool running, issel;
100extern void (*handler[LASTEvent])(XEvent *); 97extern void (*handler[LASTEvent])(XEvent *);
101extern void (*arrange)(Arg *); 98extern void (*arrange)(Arg *);
102extern Key key[]; 99extern Atom wmatom[WMLast], netatom[NetLast];
103 100extern Bool running, issel;
104extern int tsel, screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
105extern char *tags[TLast], stext[1024];
106
107extern DC dc;
108extern Client *clients, *sel; 101extern Client *clients, *sel;
102extern Cursor cursor[CurLast];
103extern DC dc;
104extern Display *dpy;
105extern Key key[];
106extern Window root, barwin;
109 107
110/* client.c */ 108/* client.c */
111extern void ban(Client *c); 109extern void ban(Client *c);
diff --git a/dwm.html b/dwm.html
index 8f0aff6..0df44b5 100644
--- a/dwm.html
+++ b/dwm.html
@@ -39,10 +39,9 @@
39 </p> 39 </p>
40 <ul> 40 <ul>
41 <li> 41 <li>
42 dwm has no 9P support, no menu, no editable tagbars, 42 dwm has no 9P support, no editable tagbars, no shell-based
43 no shell-based configuration and remote control and comes without 43 configuration and remote control and comes without any additional
44 any additional tools like printing the selection or warping the 44 tools like printing the selection or warping the mouse.
45 mouse.
46 </li> 45 </li>
47 <li> 46 <li>
48 dwm is only a single binary, it's source code is intended to never 47 dwm is only a single binary, it's source code is intended to never
diff --git a/event.c b/event.c
index ecbb8d2..0fce36b 100644
--- a/event.c
+++ b/event.c
@@ -11,45 +11,44 @@
11#define ButtonMask (ButtonPressMask | ButtonReleaseMask) 11#define ButtonMask (ButtonPressMask | ButtonReleaseMask)
12#define MouseMask (ButtonMask | PointerMotionMask) 12#define MouseMask (ButtonMask | PointerMotionMask)
13 13
14/********** CUSTOMIZE **********/ 14/* CUSTOMIZE */
15 15const char *browse[] = { "firefox", NULL };
16const char *gimp[] = { "gimp", NULL };
16const char *term[] = { 17const char *term[] = {
17 "urxvtc", "-tr", "+sb", "-bg", "black", "-fg", "white", "-cr", "white", 18 "urxvtc", "-tr", "+sb", "-bg", "black", "-fg", "white", "-cr", "white",
18 "-fn", "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*", NULL 19 "-fn", "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*", NULL
19}; 20};
20const char *browse[] = { "firefox", NULL };
21const char *xlock[] = { "xlock", NULL }; 21const char *xlock[] = { "xlock", NULL };
22 22
23Key key[] = { 23Key key[] = {
24 /* modifier key function arguments */ 24 /* modifier key function arguments */
25 { Mod1Mask, XK_Return, zoom, { 0 } }, 25 { ControlMask, XK_0, appendtag, { .i = Tscratch } },
26 { Mod1Mask, XK_k, focusprev, { 0 } }, 26 { ControlMask, XK_1, appendtag, { .i = Tdev } },
27 { Mod1Mask, XK_j, focusnext, { 0 } }, 27 { ControlMask, XK_2, appendtag, { .i = Twww } },
28 { Mod1Mask, XK_m, maximize, { 0 } }, 28 { ControlMask, XK_3, appendtag, { .i = Twork } },
29 { Mod1Mask, XK_0, view, { .i = Tscratch } }, 29 { Mod1Mask, XK_0, view, { .i = Tscratch } },
30 { Mod1Mask, XK_1, view, { .i = Tdev } }, 30 { Mod1Mask, XK_1, view, { .i = Tdev } },
31 { Mod1Mask, XK_2, view, { .i = Twww } }, 31 { Mod1Mask, XK_2, view, { .i = Twww } },
32 { Mod1Mask, XK_3, view, { .i = Twork } }, 32 { Mod1Mask, XK_3, view, { .i = Twork } },
33 { Mod1Mask, XK_j, focusnext, { 0 } },
34 { Mod1Mask, XK_k, focusprev, { 0 } },
35 { Mod1Mask, XK_m, maximize, { 0 } },
33 { Mod1Mask, XK_space, dotile, { 0 } }, 36 { Mod1Mask, XK_space, dotile, { 0 } },
34 { Mod1Mask|ShiftMask, XK_space, dofloat, { 0 } }, 37 { Mod1Mask, XK_Return, zoom, { 0 } },
35 { Mod1Mask|ShiftMask, XK_0, replacetag, { .i = Tscratch } }, 38 { Mod1Mask|ShiftMask, XK_0, replacetag, { .i = Tscratch } },
36 { Mod1Mask|ShiftMask, XK_1, replacetag, { .i = Tdev } }, 39 { Mod1Mask|ShiftMask, XK_1, replacetag, { .i = Tdev } },
37 { Mod1Mask|ShiftMask, XK_2, replacetag, { .i = Twww } }, 40 { Mod1Mask|ShiftMask, XK_2, replacetag, { .i = Twww } },
38 { Mod1Mask|ShiftMask, XK_3, replacetag, { .i = Twork } }, 41 { Mod1Mask|ShiftMask, XK_3, replacetag, { .i = Twork } },
39 { Mod1Mask|ShiftMask, XK_c, killclient, { 0 } }, 42 { Mod1Mask|ShiftMask, XK_c, killclient, { 0 } },
43 { Mod1Mask|ShiftMask, XK_g, spawn, { .argv = gimp } },
44 { Mod1Mask|ShiftMask, XK_l, spawn, { .argv = xlock } },
40 { Mod1Mask|ShiftMask, XK_q, quit, { 0 } }, 45 { Mod1Mask|ShiftMask, XK_q, quit, { 0 } },
41 { Mod1Mask|ShiftMask, XK_Return, spawn, { .argv = term } }, 46 { Mod1Mask|ShiftMask, XK_space, dofloat, { 0 } },
42 { Mod1Mask|ShiftMask, XK_w, spawn, { .argv = browse } }, 47 { Mod1Mask|ShiftMask, XK_w, spawn, { .argv = browse } },
43 { Mod1Mask|ShiftMask, XK_l, spawn, { .argv = xlock } }, 48 { Mod1Mask|ShiftMask, XK_Return, spawn, { .argv = term } },
44 { ControlMask, XK_0, appendtag, { .i = Tscratch } },
45 { ControlMask, XK_1, appendtag, { .i = Tdev } },
46 { ControlMask, XK_2, appendtag, { .i = Twww } },
47 { ControlMask, XK_3, appendtag, { .i = Twork } },
48}; 49};
49 50
50/********** CUSTOMIZE **********/ 51/* static */
51
52/* static functions */
53 52
54static void 53static void
55movemouse(Client *c) 54movemouse(Client *c)
@@ -337,7 +336,7 @@ unmapnotify(XEvent *e)
337 unmanage(c); 336 unmanage(c);
338} 337}
339 338
340/* extern functions */ 339/* extern */
341 340
342void (*handler[LASTEvent]) (XEvent *) = { 341void (*handler[LASTEvent]) (XEvent *) = {
343 [ButtonPress] = buttonpress, 342 [ButtonPress] = buttonpress,
diff --git a/main.c b/main.c
index 2d132a5..27e2627 100644
--- a/main.c
+++ b/main.c
@@ -14,26 +14,12 @@
14#include <X11/Xatom.h> 14#include <X11/Xatom.h>
15#include <X11/Xproto.h> 15#include <X11/Xproto.h>
16 16
17Display *dpy;
18Window root, barwin;
19Atom wmatom[WMLast], netatom[NetLast];
20Cursor cursor[CurLast];
21Bool running = True;
22Bool issel = True;
23
24int tsel = Tdev; /* default tag */
25int screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
26char stext[1024];
27 17
28DC dc = {0}; 18/* static */
29Client *clients = NULL;
30Client *sel = NULL;
31 19
32static Bool otherwm; 20static Bool otherwm;
33static int (*xerrorxlib)(Display *, XErrorEvent *); 21static int (*xerrorxlib)(Display *, XErrorEvent *);
34 22
35/* static functions */
36
37static void 23static void
38cleanup() 24cleanup()
39{ 25{
@@ -97,7 +83,20 @@ xerrorstart(Display *dsply, XErrorEvent *ee)
97 return -1; 83 return -1;
98} 84}
99 85
100/* extern functions */ 86/* extern */
87
88char stext[1024];
89int tsel = Tdev; /* default tag */
90int screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
91Atom wmatom[WMLast], netatom[NetLast];
92Bool running = True;
93Bool issel = True;
94Client *clients = NULL;
95Client *sel = NULL;
96Cursor cursor[CurLast];
97Display *dpy;
98DC dc = {0};
99Window root, barwin;
101 100
102int 101int
103getproto(Window w) 102getproto(Window w)
@@ -141,10 +140,9 @@ quit(Arg *arg)
141} 140}
142 141
143/* 142/*
144 * There's no way to check accesses to destroyed windows, thus 143 * There's no way to check accesses to destroyed windows, thus those cases are
145 * those cases are ignored (especially on UnmapNotify's). 144 * ignored (especially on UnmapNotify's). Other types of errors call Xlibs
146 * Other types of errors call Xlib's default error handler, which 145 * default error handler, which calls exit().
147 * calls exit().
148 */ 146 */
149int 147int
150xerror(Display *dpy, XErrorEvent *ee) 148xerror(Display *dpy, XErrorEvent *ee)
diff --git a/tag.c b/tag.c
index 48f1f2a..5da5711 100644
--- a/tag.c
+++ b/tag.c
@@ -7,24 +7,23 @@
7#include <string.h> 7#include <string.h>
8#include <X11/Xutil.h> 8#include <X11/Xutil.h>
9 9
10/********** CUSTOMIZE **********/ 10/* static */
11
12char *tags[TLast] = {
13 [Tscratch] = "scratch",
14 [Tdev] = "dev",
15 [Twww] = "www",
16 [Twork] = "work",
17};
18 11
12/* CUSTOMIZE */
19static Rule rule[] = { 13static Rule rule[] = {
20 /* class instance tags isfloat */ 14 /* class instance tags isfloat */
21 { "Firefox-bin", "Gecko", { [Twww] = "www" }, False }, 15 { "Firefox-bin", "Gecko", { [Twww] = "www" }, False },
22}; 16};
23 17
24/********** CUSTOMIZE **********/ 18/* extern */
25
26/* extern functions */
27 19
20/* CUSTOMIZE */
21char *tags[TLast] = {
22 [Tscratch] = "scratch",
23 [Tdev] = "dev",
24 [Twww] = "www",
25 [Twork] = "work",
26};
28void (*arrange)(Arg *) = dotile; 27void (*arrange)(Arg *) = dotile;
29 28
30void 29void
diff --git a/util.c b/util.c
index f7e3e6f..3e5fd1e 100644
--- a/util.c
+++ b/util.c
@@ -10,7 +10,7 @@
10#include <sys/wait.h> 10#include <sys/wait.h>
11#include <unistd.h> 11#include <unistd.h>
12 12
13/* static functions */ 13/* static */
14 14
15static void 15static void
16bad_malloc(unsigned int size) 16bad_malloc(unsigned int size)
@@ -20,7 +20,7 @@ bad_malloc(unsigned int size)
20 exit(1); 20 exit(1);
21} 21}
22 22
23/* extern functions */ 23/* extern */
24 24
25void * 25void *
26emallocz(unsigned int size) 26emallocz(unsigned int size)