JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
rearranged
[dwm.git] / dwm.h
1 /*
2  * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3  * See LICENSE file for license details.
4  */
5
6 #include <X11/Xlib.h>
7
8 /********** CUSTOMIZE **********/
9
10 #define FONT                            "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*"
11 #define BGCOLOR                         "#666699"
12 #define FGCOLOR                         "#eeeeee"
13 #define BORDERCOLOR                     "#9999CC"
14 #define MASTERW                         52 /* percent */
15 #define WM_PROTOCOL_DELWIN      1
16
17 /* tags */
18 enum { Tscratch, Tdev, Twww, Twork, TLast };
19
20 /********** CUSTOMIZE **********/
21
22 typedef union Arg Arg;
23 typedef struct DC DC;
24 typedef struct Client Client;
25 typedef struct Fnt Fnt;
26 typedef struct Key Key;
27 typedef struct Rule Rule;
28
29 union Arg {
30         const char **argv;
31         int i;
32 };
33
34 /* atoms */
35 enum { WMProtocols, WMDelete, WMLast };
36 enum { NetSupported, NetWMName, NetLast };
37
38 /* cursor */
39 enum { CurNormal, CurResize, CurMove, CurInput, CurLast };
40
41 struct Fnt {
42         XFontStruct *xfont;
43         XFontSet set;
44         int ascent;
45         int descent;
46         int height;
47 };
48
49 struct DC { /* draw context */
50         GC gc;
51         Drawable drawable;
52         int x, y, w, h;
53         Fnt font;
54         unsigned long bg;
55         unsigned long fg;
56         unsigned long border;
57 };
58
59 struct Client {
60         char name[256];
61         char *tags[TLast];
62         int proto;
63         int x, y, w, h;
64         int tx, ty, tw, th;
65         int basew, baseh, incw, inch, maxw, maxh, minw, minh;
66         int grav;
67         unsigned int border;
68         long flags; 
69         Bool floating;
70         Window win;
71         Window title;
72         Client *next;
73         Client *revert;
74 };
75
76 struct Rule {
77         const char *class;
78         const char *instance;
79         char *tags[TLast];
80         Bool floating;
81 };
82
83 struct Key {
84         unsigned long mod;
85         KeySym keysym;
86         void (*func)(Arg *arg);
87         Arg arg;
88 };
89
90 extern Display *dpy;
91 extern Window root, barwin;
92 extern Atom wm_atom[WMLast], net_atom[NetLast];
93 extern Cursor cursor[CurLast];
94 extern Bool running, issel;
95 extern void (*handler[LASTEvent])(XEvent *);
96 extern void (*arrange)(Arg *);
97 extern Key key[];
98
99 extern int tsel, screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
100 extern char *tags[TLast], stext[1024];
101
102 extern DC dc;
103 extern Client *clients, *sel;
104
105 /* client.c */
106 extern void manage(Window w, XWindowAttributes *wa);
107 extern void unmanage(Client *c);
108 extern Client *getclient(Window w);
109 extern void focus(Client *c);
110 extern void update_name(Client *c);
111 extern void resize(Client *c, Bool inc);
112 extern void update_size(Client *c);
113 extern Client *gettitle(Window w);
114 extern void craise(Client *c);
115 extern void lower(Client *c);
116 extern void gravitate(Client *c, Bool invert);
117 extern void ban_client(Client *c);
118 extern Client *next(Client *c);
119
120 /* draw.c */
121 extern void draw_bar();
122 extern void draw_client(Client *c);
123 extern void drawtext(const char *text, Bool invert, Bool border);
124 extern unsigned long initcolor(const char *colstr);
125 extern void initfont(const char *fontstr);
126 extern unsigned int textnw(char *text, unsigned int len);
127 extern unsigned int textw(char *text);
128 extern unsigned int texth(void);
129
130 /* key.c */
131 extern void grabkeys();
132 extern void keypress(XEvent *e);
133
134 /* main.c */
135 extern int error_handler(Display *dsply, XErrorEvent *e);
136 extern void send_message(Window w, Atom a, long value);
137 extern int win_proto(Window w);
138 extern void quit(Arg *arg);
139
140 /* screen.c */
141 extern void floating(Arg *arg);
142 extern void tiling(Arg *arg);
143 extern void view(Arg *arg);
144
145 /* util.c */
146 extern void error(const char *errstr, ...);
147 extern void *emallocz(unsigned int size);
148 extern void spawn(Arg *arg);