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