simplify proto
[awesome.git] / config.h
blobc485d963c664216fce26376d021af3ceff0da6a9
1 /*
2 * config.h - configuration management header
4 * Copyright © 2007 Julien Danjou <julien@danjou.info>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #ifndef AWESOME_CONFIG_H
23 #define AWESOME_CONFIG_H
25 #include <X11/Xlib.h>
26 #include <X11/Xft/Xft.h>
27 #include <regex.h>
28 #include <draw.h>
30 /** Bar possible position */
31 enum
32 { BarTop, BarBot, BarLeft, BarRight, BarOff };
34 /** Common colors */
35 enum
36 { ColBorder, ColFG, ColBG, ColLast };
38 enum
39 { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
41 typedef struct Rule Rule;
42 struct Rule
44 char *prop;
45 char *tags;
46 int screen;
47 Bool isfloating;
48 regex_t *propregex;
49 regex_t *tagregex;
50 Rule *next;
53 typedef struct AwesomeConf AwesomeConf;
55 typedef struct Layout Layout;
56 struct Layout
58 char *image;
59 void (*arrange) (int);
60 Layout *next;
63 typedef struct Key Key;
64 struct Key
66 unsigned long mod;
67 KeySym keysym;
68 void (*func) (int, char *);
69 char *arg;
70 Key *next;
73 typedef struct Button Button;
74 struct Button
76 unsigned long mod;
77 unsigned int button;
78 void (*func) (int, char *);
79 char *arg;
80 Button *next;
83 /** Status bar */
84 typedef struct Widget Widget;
85 typedef struct
87 /** Bar width */
88 int width;
89 /** Bar height */
90 int height;
91 /** Layout txt width */
92 int txtlayoutwidth;
93 /** Default position */
94 int dposition;
95 /** Bar position */
96 int position;
97 /** Window */
98 Window window;
99 /** Screen */
100 int screen;
101 /** Screen */
102 Widget *widgets;
103 } Statusbar;
105 typedef struct Client Client;
106 struct Client
108 /** Client name */
109 char name[256];
110 /** Window geometry */
111 int x, y, w, h;
112 /** Real window geometry for floating */
113 int rx, ry, rw, rh;
114 int basew, baseh, incw, inch, maxw, maxh, minw, minh;
115 int minax, maxax, minay, maxay;
116 long flags;
117 int border, oldborder;
118 /** Has urgency hint */
119 Bool isurgent;
120 /** Store previous floating state before maximizing */
121 Bool wasfloating;
122 /** True if the window is floating */
123 Bool isfloating;
124 /** True if the window is fixed */
125 Bool isfixed;
126 /** True if the window is maximized */
127 Bool ismax;
128 /** Next client */
129 Client *next;
130 /** Previous client */
131 Client *prev;
132 /** Window of the client */
133 Window win;
134 /** Client display */
135 Display *display;
136 /** Client logical screen */
137 int screen;
138 /** Client physical screen */
139 int phys_screen;
142 typedef struct FocusList FocusList;
143 struct FocusList
145 Client *client;
146 FocusList *prev;
149 /** Tag type */
150 typedef struct Tag Tag;
151 struct Tag
153 /** Tag name */
154 char *name;
155 /** True if selected */
156 Bool selected;
157 /** True if was selected before selecting others tags */
158 Bool was_selected;
159 /** Current tag layout */
160 Layout *layout;
161 /** Master width factor */
162 double mwfact;
163 /** Number of master windows */
164 int nmaster;
165 /** Number of columns in tile layout */
166 int ncol;
167 /** Next tag */
168 Tag *next;
171 /** TagClientLink type */
172 typedef struct TagClientLink TagClientLink;
173 struct TagClientLink
175 Tag *tag;
176 Client *client;
177 TagClientLink *next;
180 /** Padding type */
181 typedef struct
183 /** Padding at top */
184 int top;
185 /** Padding at bottom */
186 int bottom;
187 /** Padding at left */
188 int left;
189 /** Padding at right */
190 int right;
191 } Padding;
193 typedef struct
195 /** Number of pixels to snap windows */
196 int snap;
197 /** Border size */
198 int borderpx;
199 /** Transparency of unfocused clients */
200 int opacity_unfocused;
201 /** Focus move pointer */
202 Bool focus_move_pointer;
203 /** Allow floats to be lowered on focus change */
204 Bool allow_lower_floats;
205 /** Respect resize hints */
206 Bool resize_hints;
207 /** Normal colors */
208 XColor colors_normal[ColLast];
209 /** Selected colors */
210 XColor colors_selected[ColLast];
211 /** Urgency colors */
212 XColor colors_urgent[ColLast];
213 /** Tag list */
214 Tag *tags;
215 TagClientLink *tclink;
216 /** Layout list */
217 Layout *layouts;
218 /** Status bar */
219 Statusbar *statusbar;
220 /** Padding */
221 Padding padding;
222 /** Font */
223 XftFont *font;
224 } VirtScreen;
227 struct Widget
229 char *name;
230 int (*draw)(Widget *, DrawCtx *, int, int);
231 void (*tell)(Widget *, char *);
232 Statusbar *statusbar;
233 int alignment;
234 void *data;
235 int location;
236 int width;
237 Widget *next;
241 /** Main configuration structure */
242 struct AwesomeConf
244 /** Display ref */
245 Display *display;
246 /** Logical screens */
247 VirtScreen *screens;
248 /** Rules list */
249 Rule *rules;
250 /** Keys bindings list */
251 Key *keys;
252 /** Mouse bindings list */
253 struct
255 Button *tag;
256 Button *title;
257 Button *layout;
258 Button *root;
259 Button *client;
260 } buttons;
261 /** Numlock mask */
262 unsigned int numlockmask;
263 /** Check for XShape extension */
264 Bool have_shape;
265 /** Check for XRandR extension */
266 Bool have_randr;
267 /** Cursors */
268 Cursor cursor[CurLast];
269 /** Clients list */
270 Client *clients;
271 /** Path to config file */
272 char *configpath;
273 /** Selected clients on this tag */
274 FocusList *focus;
277 void config_parse(const char *);
279 #endif
280 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80