rev |
line source |
garbeam@0
|
1 /*
|
garbeam@0
|
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
garbeam@0
|
3 * See LICENSE file for license details.
|
garbeam@0
|
4 */
|
garbeam@0
|
5
|
garbeam@32
|
6 #include <X11/Xlib.h>
|
garbeam@2
|
7
|
garbeam@32
|
8 /********** CUSTOMIZE **********/
|
garbeam@0
|
9
|
garbeam@51
|
10 #define FONT "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*"
|
garbeam@78
|
11 #define BGCOLOR "#0a2c2d"
|
garbeam@78
|
12 #define FGCOLOR "#ddeeee"
|
garbeam@78
|
13 #define BORDERCOLOR "#176164"
|
arg@113
|
14 #define MODKEY Mod1Mask /* Mod4Mask */
|
garbeam@78
|
15 /*
|
garbeam@51
|
16 #define BGCOLOR "#666699"
|
garbeam@59
|
17 #define FGCOLOR "#eeeeee"
|
garbeam@51
|
18 #define BORDERCOLOR "#9999CC"
|
garbeam@78
|
19 */
|
garbeam@51
|
20 #define MASTERW 52 /* percent */
|
garbeam@51
|
21 #define WM_PROTOCOL_DELWIN 1
|
garbeam@13
|
22
|
garbeam@32
|
23 /* tags */
|
garbeam@59
|
24 enum { Tscratch, Tdev, Twww, Twork, TLast };
|
garbeam@32
|
25
|
garbeam@32
|
26 /********** CUSTOMIZE **********/
|
garbeam@32
|
27
|
garbeam@51
|
28 typedef union Arg Arg;
|
arg@105
|
29 typedef struct Client Client;
|
arg@99
|
30 typedef enum Corner Corner;
|
garbeam@34
|
31 typedef struct DC DC;
|
garbeam@32
|
32 typedef struct Fnt Fnt;
|
garbeam@18
|
33 typedef struct Key Key;
|
garbeam@51
|
34 typedef struct Rule Rule;
|
garbeam@49
|
35
|
garbeam@49
|
36 union Arg {
|
garbeam@49
|
37 const char **argv;
|
garbeam@49
|
38 int i;
|
garbeam@49
|
39 };
|
garbeam@18
|
40
|
garbeam@5
|
41 /* atoms */
|
garbeam@84
|
42 enum { NetSupported, NetWMName, NetLast };
|
garbeam@13
|
43 enum { WMProtocols, WMDelete, WMLast };
|
garbeam@0
|
44
|
garbeam@5
|
45 /* cursor */
|
garbeam@84
|
46 enum { CurNormal, CurResize, CurMove, CurLast };
|
garbeam@0
|
47
|
arg@105
|
48 enum Corner { TopLeft, TopRight, BotLeft, BotRight };
|
arg@99
|
49
|
garbeam@32
|
50 struct Fnt {
|
garbeam@32
|
51 int ascent;
|
garbeam@32
|
52 int descent;
|
garbeam@32
|
53 int height;
|
garbeam@84
|
54 XFontSet set;
|
garbeam@84
|
55 XFontStruct *xfont;
|
garbeam@32
|
56 };
|
garbeam@32
|
57
|
garbeam@34
|
58 struct DC { /* draw context */
|
garbeam@32
|
59 int x, y, w, h;
|
garbeam@32
|
60 unsigned long bg;
|
garbeam@32
|
61 unsigned long fg;
|
garbeam@32
|
62 unsigned long border;
|
garbeam@84
|
63 Drawable drawable;
|
garbeam@84
|
64 Fnt font;
|
garbeam@84
|
65 GC gc;
|
garbeam@32
|
66 };
|
garbeam@32
|
67
|
garbeam@0
|
68 struct Client {
|
garbeam@31
|
69 char name[256];
|
garbeam@31
|
70 char *tags[TLast];
|
garbeam@13
|
71 int proto;
|
garbeam@95
|
72 int *x, *y, *w, *h; /* current geom */
|
garbeam@95
|
73 int bx, by, bw, bh; /* title bar */
|
garbeam@95
|
74 int fx, fy, fw, fh; /* floating geom */
|
garbeam@95
|
75 int tx, ty, tw, th; /* tiled geom */
|
garbeam@20
|
76 int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
garbeam@29
|
77 int grav;
|
garbeam@29
|
78 unsigned int border;
|
garbeam@20
|
79 long flags;
|
garbeam@80
|
80 Bool isfloat;
|
garbeam@84
|
81 Client *next;
|
garbeam@84
|
82 Client *revert;
|
garbeam@0
|
83 Window win;
|
garbeam@0
|
84 Window title;
|
garbeam@0
|
85 };
|
garbeam@0
|
86
|
garbeam@51
|
87 struct Rule {
|
garbeam@51
|
88 const char *class;
|
garbeam@51
|
89 const char *instance;
|
garbeam@51
|
90 char *tags[TLast];
|
garbeam@80
|
91 Bool isfloat;
|
garbeam@51
|
92 };
|
garbeam@51
|
93
|
garbeam@8
|
94 struct Key {
|
garbeam@8
|
95 unsigned long mod;
|
garbeam@8
|
96 KeySym keysym;
|
garbeam@49
|
97 void (*func)(Arg *arg);
|
garbeam@49
|
98 Arg arg;
|
garbeam@8
|
99 };
|
garbeam@8
|
100
|
garbeam@84
|
101 extern char *tags[TLast], stext[1024];
|
garbeam@84
|
102 extern int tsel, screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
|
garbeam@53
|
103 extern void (*handler[LASTEvent])(XEvent *);
|
garbeam@53
|
104 extern void (*arrange)(Arg *);
|
garbeam@84
|
105 extern Atom wmatom[WMLast], netatom[NetLast];
|
garbeam@84
|
106 extern Bool running, issel;
|
garbeam@84
|
107 extern Client *clients, *sel;
|
garbeam@84
|
108 extern Cursor cursor[CurLast];
|
garbeam@84
|
109 extern DC dc;
|
garbeam@84
|
110 extern Display *dpy;
|
garbeam@73
|
111 extern Key key[];
|
garbeam@84
|
112 extern Window root, barwin;
|
garbeam@3
|
113
|
garbeam@5
|
114 /* client.c */
|
garbeam@75
|
115 extern void ban(Client *c);
|
garbeam@76
|
116 extern void focus(Client *c);
|
garbeam@76
|
117 extern void focusnext(Arg *arg);
|
garbeam@76
|
118 extern void focusprev(Arg *arg);
|
garbeam@76
|
119 extern Client *getclient(Window w);
|
garbeam@76
|
120 extern Client *getctitle(Window w);
|
garbeam@76
|
121 extern void gravitate(Client *c, Bool invert);
|
garbeam@76
|
122 extern void higher(Client *c);
|
garbeam@76
|
123 extern void killclient(Arg *arg);
|
garbeam@76
|
124 extern void lower(Client *c);
|
garbeam@10
|
125 extern void manage(Window w, XWindowAttributes *wa);
|
garbeam@76
|
126 extern void maximize(Arg *arg);
|
garbeam@94
|
127 extern void pop(Client *c);
|
arg@99
|
128 extern void resize(Client *c, Bool inc, Corner sticky);
|
garbeam@95
|
129 extern void setgeom(Client *c);
|
garbeam@74
|
130 extern void setsize(Client *c);
|
garbeam@76
|
131 extern void settitle(Client *c);
|
garbeam@76
|
132 extern void unmanage(Client *c);
|
garbeam@75
|
133 extern void zoom(Arg *arg);
|
garbeam@13
|
134
|
garbeam@33
|
135 /* draw.c */
|
garbeam@75
|
136 extern void drawall();
|
garbeam@74
|
137 extern void drawstatus();
|
garbeam@74
|
138 extern void drawtitle(Client *c);
|
garbeam@74
|
139 extern unsigned long getcolor(const char *colstr);
|
garbeam@74
|
140 extern void setfont(const char *fontstr);
|
garbeam@43
|
141 extern unsigned int textw(char *text);
|
garbeam@33
|
142
|
garbeam@75
|
143 /* event.c */
|
garbeam@73
|
144 extern void grabkeys();
|
garbeam@18
|
145
|
garbeam@43
|
146 /* main.c */
|
garbeam@76
|
147 extern int getproto(Window w);
|
garbeam@75
|
148 extern void quit(Arg *arg);
|
garbeam@76
|
149 extern void sendevent(Window w, Atom a, long value);
|
garbeam@75
|
150 extern int xerror(Display *dsply, XErrorEvent *ee);
|
garbeam@43
|
151
|
garbeam@75
|
152 /* tag.c */
|
garbeam@76
|
153 extern void appendtag(Arg *arg);
|
garbeam@75
|
154 extern void dofloat(Arg *arg);
|
garbeam@75
|
155 extern void dotile(Arg *arg);
|
garbeam@93
|
156 extern Client *getnext(Client *c, unsigned int t);
|
garbeam@93
|
157 extern void heretag(Arg *arg);
|
garbeam@76
|
158 extern void replacetag(Arg *arg);
|
garbeam@76
|
159 extern void settags(Client *c);
|
garbeam@73
|
160 extern void view(Arg *arg);
|
garbeam@73
|
161
|
garbeam@32
|
162 /* util.c */
|
garbeam@76
|
163 extern void *emallocz(unsigned int size);
|
garbeam@75
|
164 extern void eprint(const char *errstr, ...);
|
garbeam@49
|
165 extern void spawn(Arg *arg);
|