use list function for Widget
[awesome.git] / config.h
blob3454df21df2833c1ad157ea902fb727c98d26a4f
1 /*
2 * config.h - configuration management header
4 * Copyright © 2007-2008 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 <regex.h>
26 #include "draw.h"
27 #include "layout.h"
28 #include "util.h"
29 #include "list.h"
31 /** Bar possible position */
32 typedef enum
34 Top,
35 Bottom,
36 Left,
37 Right,
38 Off
39 } Position;
41 typedef enum
43 Float,
44 Tile,
45 Auto,
46 } RuleFloat;
48 /** Common colors */
49 enum
50 { ColBorder, ColFG, ColBG, ColLast };
52 enum
53 { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
55 typedef struct Rule Rule;
56 struct Rule
58 char *icon;
59 char *xprop;
60 int screen;
61 RuleFloat isfloating;
62 Bool not_master;
63 regex_t *prop_r;
64 regex_t *tags_r;
65 regex_t *xpropval_r;
66 Rule *next;
69 DO_SLIST(Rule, rule, p_delete);
71 typedef struct AwesomeConf AwesomeConf;
73 typedef struct Key Key;
74 struct Key
76 unsigned long mod;
77 KeySym keysym;
78 Uicb *func;
79 char *arg;
80 Key *next;
83 DO_SLIST(Key, key, p_delete);
85 typedef struct Button Button;
86 struct Button
88 unsigned long mod;
89 unsigned int button;
90 Uicb *func;
91 char *arg;
92 Button *next;
95 DO_SLIST(Button, button, p_delete);
97 /** Widget */
98 typedef struct Widget Widget;
99 typedef struct Statusbar Statusbar;
100 struct Widget
102 /** Widget name */
103 char *name;
104 /** Draw function */
105 int (*draw)(Widget *, DrawCtx *, int, int);
106 /** Update function */
107 void (*tell)(Widget *, char *);
108 /** ButtonPressedEvent handler */
109 void (*button_press)(Widget *, XButtonPressedEvent *);
110 /** Statusbar */
111 Statusbar *statusbar;
112 /** Alignement */
113 Alignment alignment;
114 /** Misc private data */
115 void *data;
116 /** True if user supplied coords */
117 Bool user_supplied_x;
118 Bool user_supplied_y;
119 /** Area */
120 Area area;
121 /** Buttons bindings */
122 Button *buttons;
123 /** Font */
124 XftFont *font;
125 /** Cache */
126 struct
128 Bool needs_update;
129 int flags;
130 } cache;
131 /** Next widget */
132 Widget *next;
135 DO_SLIST(Widget, widget, p_delete);
137 /** Status bar */
138 struct Statusbar
140 /** Statusbar name */
141 char *name;
142 /** Bar width */
143 int width;
144 /** Bar height */
145 int height;
146 /** Layout txt width */
147 int txtlayoutwidth;
148 /** Default position */
149 Position dposition;
150 /** Bar position */
151 Position position;
152 /** Window */
153 Window window;
154 /** Screen */
155 int screen;
156 /** Widget list */
157 Widget *widgets;
158 /** Drawable */
159 Drawable drawable;
160 /** Next statusbar */
161 Statusbar *next;
164 typedef struct Client Client;
165 struct Client
167 /** Client name */
168 char name[256];
169 /** Window geometry */
170 Area geometry;
171 /** Floating window geometry */
172 Area f_geometry;
173 /** Max window geometry */
174 Area m_geometry;
175 int basew, baseh, incw, inch, maxw, maxh, minw, minh;
176 int minax, maxax, minay, maxay;
177 int border, oldborder;
178 /** Has urgency hint */
179 Bool isurgent;
180 /** Store previous floating state before maximizing */
181 Bool wasfloating;
182 /** True if the window is floating */
183 Bool isfloating;
184 /** True if the window is fixed */
185 Bool isfixed;
186 /** True if the window is maximized */
187 Bool ismax;
188 /** True if the client must be skipped from client list */
189 Bool skip;
190 /** True if the client must be skipped from task bar client list */
191 Bool skiptb;
192 /** Next client */
193 Client *next;
194 /** Window of the client */
195 Window win;
196 /** Client logical screen */
197 int screen;
198 /** True if the client is a new one */
199 Bool newcomer;
202 DO_SLIST(Client, client, p_delete);
204 typedef struct FocusList FocusList;
205 struct FocusList
207 Client *client;
208 FocusList *prev;
211 /** Tag type */
212 typedef struct Tag Tag;
213 struct Tag
215 /** Tag name */
216 char *name;
217 /** True if selected */
218 Bool selected;
219 /** True if was selected before selecting others tags */
220 Bool was_selected;
221 /** Current tag layout */
222 Layout *layout;
223 /** Master width factor */
224 double mwfact;
225 /** Number of master windows */
226 int nmaster;
227 /** Number of columns in tile layout */
228 int ncol;
229 /** Next tag */
230 Tag *next;
233 /** TagClientLink type */
234 typedef struct TagClientLink TagClientLink;
235 struct TagClientLink
237 Tag *tag;
238 Client *client;
239 TagClientLink *next;
242 /** Padding type */
243 typedef struct
245 /** Padding at top */
246 int top;
247 /** Padding at bottom */
248 int bottom;
249 /** Padding at left */
250 int left;
251 /** Padding at right */
252 int right;
253 } Padding;
255 typedef struct
257 /** Number of pixels to snap windows */
258 int snap;
259 /** Border size */
260 int borderpx;
261 /** Transparency of unfocused clients */
262 int opacity_unfocused;
263 /** Focus move pointer */
264 Bool focus_move_pointer;
265 /** Allow floats to be lowered on focus change */
266 Bool allow_lower_floats;
267 /** Respect resize hints */
268 Bool resize_hints;
269 /** Sloppy focus: focus follow mouse */
270 Bool sloppy_focus;
271 /** Focus new clients */
272 Bool new_get_focus;
273 /** True if new clients should become master */
274 Bool new_become_master;
275 /** Normal colors */
276 XColor colors_normal[ColLast];
277 /** Selected colors */
278 XColor colors_selected[ColLast];
279 /** Urgency colors */
280 XColor colors_urgent[ColLast];
281 /** Tag list */
282 Tag *tags;
283 /** Layout list */
284 Layout *layouts;
285 /** Status bar */
286 Statusbar *statusbar;
287 /** Padding */
288 Padding padding;
289 /** Font */
290 XftFont *font;
291 } VirtScreen;
293 /** Main configuration structure */
294 struct AwesomeConf
296 /** Display ref */
297 Display *display;
298 /** Logical screens */
299 VirtScreen *screens;
300 /** Number of logical screens */
301 int nscreens;
302 /** Rules list */
303 Rule *rules;
304 /** Keys bindings list */
305 Key *keys;
306 /** Mouse bindings list */
307 struct
309 Button *root;
310 Button *client;
311 } buttons;
312 /** Numlock mask */
313 unsigned int numlockmask;
314 /** Check for XShape extension */
315 Bool have_shape;
316 /** Check for XRandR extension */
317 Bool have_randr;
318 /** Cursors */
319 Cursor cursor[CurLast];
320 /** Clients list */
321 Client *clients;
322 /** Path to config file */
323 char *configpath;
324 /** Selected clients on this tag */
325 FocusList *focus;
326 /** Link between tags and clients */
327 TagClientLink *tclink;
328 /** Command line passed to awesome */
329 char *argv;
332 void config_parse(const char *);
334 #endif
335 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80