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
|
arg@125
|
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
|
arg@125
|
26 /* END 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@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@84
|
40 enum { NetSupported, NetWMName, NetLast };
|
garbeam@13
|
41 enum { WMProtocols, WMDelete, WMLast };
|
garbeam@0
|
42
|
garbeam@5
|
43 /* cursor */
|
garbeam@84
|
44 enum { CurNormal, CurResize, CurMove, CurLast };
|
garbeam@0
|
45
|
arg@105
|
46 enum Corner { TopLeft, TopRight, BotLeft, BotRight };
|
arg@99
|
47
|
garbeam@32
|
48 struct Fnt {
|
garbeam@32
|
49 int ascent;
|
garbeam@32
|
50 int descent;
|
garbeam@32
|
51 int height;
|
garbeam@84
|
52 XFontSet set;
|
garbeam@84
|
53 XFontStruct *xfont;
|
garbeam@32
|
54 };
|
garbeam@32
|
55
|
garbeam@34
|
56 struct DC { /* draw context */
|
garbeam@32
|
57 int x, y, w, h;
|
garbeam@32
|
58 unsigned long bg;
|
garbeam@32
|
59 unsigned long fg;
|
garbeam@32
|
60 unsigned long border;
|
garbeam@84
|
61 Drawable drawable;
|
garbeam@84
|
62 Fnt font;
|
garbeam@84
|
63 GC gc;
|
garbeam@32
|
64 };
|
garbeam@32
|
65
|
garbeam@0
|
66 struct Client {
|
garbeam@31
|
67 char name[256];
|
garbeam@31
|
68 char *tags[TLast];
|
garbeam@13
|
69 int proto;
|
arg@115
|
70 int x, y, w, h;
|
arg@115
|
71 int tx, ty, tw, th; /* title */
|
garbeam@20
|
72 int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
garbeam@29
|
73 int grav;
|
garbeam@29
|
74 unsigned int border;
|
garbeam@20
|
75 long flags;
|
garbeam@80
|
76 Bool isfloat;
|
arg@124
|
77 Bool ismax;
|
garbeam@84
|
78 Client *next;
|
arg@127
|
79 Client *prev;
|
garbeam@0
|
80 Window win;
|
garbeam@0
|
81 Window title;
|
garbeam@0
|
82 };
|
garbeam@0
|
83
|
garbeam@84
|
84 extern char *tags[TLast], stext[1024];
|
garbeam@84
|
85 extern int tsel, screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
|
garbeam@53
|
86 extern void (*handler[LASTEvent])(XEvent *);
|
garbeam@53
|
87 extern void (*arrange)(Arg *);
|
garbeam@84
|
88 extern Atom wmatom[WMLast], netatom[NetLast];
|
garbeam@84
|
89 extern Bool running, issel;
|
garbeam@84
|
90 extern Client *clients, *sel;
|
garbeam@84
|
91 extern Cursor cursor[CurLast];
|
garbeam@84
|
92 extern DC dc;
|
garbeam@84
|
93 extern Display *dpy;
|
garbeam@84
|
94 extern Window root, barwin;
|
garbeam@3
|
95
|
garbeam@5
|
96 /* client.c */
|
garbeam@75
|
97 extern void ban(Client *c);
|
garbeam@76
|
98 extern void focus(Client *c);
|
garbeam@76
|
99 extern void focusnext(Arg *arg);
|
garbeam@76
|
100 extern void focusprev(Arg *arg);
|
garbeam@76
|
101 extern Client *getclient(Window w);
|
garbeam@76
|
102 extern Client *getctitle(Window w);
|
garbeam@76
|
103 extern void gravitate(Client *c, Bool invert);
|
garbeam@76
|
104 extern void higher(Client *c);
|
garbeam@76
|
105 extern void killclient(Arg *arg);
|
garbeam@76
|
106 extern void lower(Client *c);
|
garbeam@10
|
107 extern void manage(Window w, XWindowAttributes *wa);
|
garbeam@94
|
108 extern void pop(Client *c);
|
arg@129
|
109 extern void resize(Client *c, Bool sizehints, Corner sticky);
|
garbeam@74
|
110 extern void setsize(Client *c);
|
garbeam@76
|
111 extern void settitle(Client *c);
|
arg@124
|
112 extern void togglemax(Arg *arg);
|
garbeam@76
|
113 extern void unmanage(Client *c);
|
garbeam@75
|
114 extern void zoom(Arg *arg);
|
garbeam@13
|
115
|
garbeam@33
|
116 /* draw.c */
|
garbeam@75
|
117 extern void drawall();
|
garbeam@74
|
118 extern void drawstatus();
|
garbeam@74
|
119 extern void drawtitle(Client *c);
|
garbeam@74
|
120 extern unsigned long getcolor(const char *colstr);
|
garbeam@74
|
121 extern void setfont(const char *fontstr);
|
garbeam@43
|
122 extern unsigned int textw(char *text);
|
garbeam@33
|
123
|
garbeam@75
|
124 /* event.c */
|
garbeam@73
|
125 extern void grabkeys();
|
garbeam@18
|
126
|
garbeam@43
|
127 /* main.c */
|
garbeam@76
|
128 extern int getproto(Window w);
|
garbeam@75
|
129 extern void quit(Arg *arg);
|
garbeam@76
|
130 extern void sendevent(Window w, Atom a, long value);
|
garbeam@75
|
131 extern int xerror(Display *dsply, XErrorEvent *ee);
|
garbeam@43
|
132
|
garbeam@75
|
133 /* tag.c */
|
garbeam@76
|
134 extern void appendtag(Arg *arg);
|
garbeam@75
|
135 extern void dofloat(Arg *arg);
|
garbeam@75
|
136 extern void dotile(Arg *arg);
|
garbeam@93
|
137 extern Client *getnext(Client *c, unsigned int t);
|
arg@127
|
138 extern Client *getprev(Client *c);
|
garbeam@93
|
139 extern void heretag(Arg *arg);
|
garbeam@76
|
140 extern void replacetag(Arg *arg);
|
garbeam@76
|
141 extern void settags(Client *c);
|
arg@124
|
142 extern void togglemode(Arg *arg);
|
garbeam@73
|
143 extern void view(Arg *arg);
|
garbeam@73
|
144
|
garbeam@32
|
145 /* util.c */
|
garbeam@76
|
146 extern void *emallocz(unsigned int size);
|
garbeam@75
|
147 extern void eprint(const char *errstr, ...);
|
garbeam@49
|
148 extern void spawn(Arg *arg);
|