use Area in Widget
[awesome.git] / config.h
blob6eb18df6030f3615d4bbbe68834efc8dfc398427
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"
29 /** Bar possible position */
30 typedef enum
32 Top,
33 Bottom,
34 Left,
35 Right,
36 Off
37 } Position;
39 /** Common colors */
40 enum
41 { ColBorder, ColFG, ColBG, ColLast };
43 enum
44 { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
46 typedef struct Rule Rule;
47 struct Rule
49 char *icon;
50 char *xprop;
51 int screen;
52 Bool isfloating;
53 Bool not_master;
54 regex_t *prop_r;
55 regex_t *tags_r;
56 regex_t *xpropval_r;
57 Rule *next;
60 typedef struct AwesomeConf AwesomeConf;
62 typedef struct Layout Layout;
63 struct Layout
65 char *image;
66 LayoutArrange *arrange;
67 Layout *next;
70 typedef struct Key Key;
71 struct Key
73 unsigned long mod;
74 KeySym keysym;
75 Uicb *func;
76 char *arg;
77 Key *next;
80 typedef struct Button Button;
81 struct Button
83 unsigned long mod;
84 unsigned int button;
85 Uicb *func;
86 char *arg;
87 Button *next;
90 /** Widget */
91 typedef struct Widget Widget;
92 typedef struct Statusbar Statusbar;
93 struct Widget
95 /** Widget name */
96 char *name;
97 /** Draw function */
98 int (*draw)(Widget *, DrawCtx *, int, int);
99 /** Update function */
100 void (*tell)(Widget *, char *);
101 /** ButtonPressedEvent handler */
102 void (*button_press)(Widget *, XButtonPressedEvent *);
103 /** Statusbar */
104 Statusbar *statusbar;
105 /** Alignement */
106 Alignment alignment;
107 /** Misc private data */
108 void *data;
109 /** Area */
110 Area area;
111 /** Buttons bindings */
112 Button *buttons;
113 /** Font */
114 XftFont *font;
115 /** Next widget */
116 Widget *next;
119 /** Status bar */
120 struct Statusbar
122 /** Statusbar name */
123 char *name;
124 /** Bar width */
125 int width;
126 /** Bar height */
127 int height;
128 /** Layout txt width */
129 int txtlayoutwidth;
130 /** Default position */
131 Position dposition;
132 /** Bar position */
133 Position position;
134 /** Window */
135 Window window;
136 /** Screen */
137 int screen;
138 /** Widget list */
139 Widget *widgets;
140 /** Drawable */
141 Drawable drawable;
142 /** Next statusbar */
143 Statusbar *next;
146 typedef struct Client Client;
147 struct Client
149 /** Client name */
150 char name[256];
151 /** Window geometry */
152 int x, y, w, h;
153 /** Real window geometry for floating */
154 int rx, ry, rw, rh;
155 int basew, baseh, incw, inch, maxw, maxh, minw, minh;
156 int minax, maxax, minay, maxay;
157 long flags;
158 int border, oldborder;
159 /** Has urgency hint */
160 Bool isurgent;
161 /** Store previous floating state before maximizing */
162 Bool wasfloating;
163 /** True if the window is floating */
164 Bool isfloating;
165 /** True if the window is fixed */
166 Bool isfixed;
167 /** True if the window is maximized */
168 Bool ismax;
169 /** True if the client must be skipped from client list */
170 Bool skip;
171 /** True if the client must be skipped from task bar client list */
172 Bool skiptb;
173 /** Next client */
174 Client *next;
175 /** Previous client */
176 Client *prev;
177 /** Window of the client */
178 Window win;
179 /** Client logical screen */
180 int screen;
183 typedef struct FocusList FocusList;
184 struct FocusList
186 Client *client;
187 FocusList *prev;
190 /** Tag type */
191 typedef struct Tag Tag;
192 struct Tag
194 /** Tag name */
195 char *name;
196 /** True if selected */
197 Bool selected;
198 /** True if was selected before selecting others tags */
199 Bool was_selected;
200 /** Current tag layout */
201 Layout *layout;
202 /** Master width factor */
203 double mwfact;
204 /** Number of master windows */
205 int nmaster;
206 /** Number of columns in tile layout */
207 int ncol;
208 /** Next tag */
209 Tag *next;
212 /** TagClientLink type */
213 typedef struct TagClientLink TagClientLink;
214 struct TagClientLink
216 Tag *tag;
217 Client *client;
218 TagClientLink *next;
221 /** Padding type */
222 typedef struct
224 /** Padding at top */
225 int top;
226 /** Padding at bottom */
227 int bottom;
228 /** Padding at left */
229 int left;
230 /** Padding at right */
231 int right;
232 } Padding;
234 typedef struct
236 /** Number of pixels to snap windows */
237 int snap;
238 /** Border size */
239 int borderpx;
240 /** Transparency of unfocused clients */
241 int opacity_unfocused;
242 /** Focus move pointer */
243 Bool focus_move_pointer;
244 /** Allow floats to be lowered on focus change */
245 Bool allow_lower_floats;
246 /** Respect resize hints */
247 Bool resize_hints;
248 /** Sloppy focus: focus follow mouse */
249 Bool sloppy_focus;
250 /** True if new clients should become master */
251 Bool new_become_master;
252 /** Normal colors */
253 XColor colors_normal[ColLast];
254 /** Selected colors */
255 XColor colors_selected[ColLast];
256 /** Urgency colors */
257 XColor colors_urgent[ColLast];
258 /** Tag list */
259 Tag *tags;
260 /** Layout list */
261 Layout *layouts;
262 /** Status bar */
263 Statusbar *statusbar;
264 /** Padding */
265 Padding padding;
266 /** Font */
267 XftFont *font;
268 } VirtScreen;
270 /** Main configuration structure */
271 struct AwesomeConf
273 /** Display ref */
274 Display *display;
275 /** Logical screens */
276 VirtScreen *screens;
277 /** Rules list */
278 Rule *rules;
279 /** Keys bindings list */
280 Key *keys;
281 /** Mouse bindings list */
282 struct
284 Button *root;
285 Button *client;
286 } buttons;
287 /** Numlock mask */
288 unsigned int numlockmask;
289 /** Check for XShape extension */
290 Bool have_shape;
291 /** Check for XRandR extension */
292 Bool have_randr;
293 /** Cursors */
294 Cursor cursor[CurLast];
295 /** Clients list */
296 Client *clients;
297 /** Path to config file */
298 char *configpath;
299 /** Selected clients on this tag */
300 FocusList *focus;
301 /** Link between tags and clients */
302 TagClientLink *tclink;
305 void config_parse(const char *);
307 #endif
308 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80