[awesome-menu] rewrite handling of ~ which was too buggy
[awesome.git] / structs.h
blobd736f9e3a5c4bbd8406d38baaa10597a1a8f826d
1 /*
2 * structs.h - basic structs 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_STRUCTS_H
23 #define AWESOME_STRUCTS_H
25 #include <regex.h>
26 #include "layout.h"
27 #include "common/draw.h"
28 #include "common/swindow.h"
30 /** Bar possible position */
31 typedef enum
33 Top,
34 Bottom,
35 Left,
36 Right,
37 Off
38 } Position;
40 /** Rules for floating rule */
41 typedef enum
43 No = False,
44 Yes = True,
45 Auto
46 } Fuzzy;
48 /** Common colors */
49 enum
50 { ColBorder, ColFG, ColBG, ColLast };
52 /** Cursors */
53 enum
54 { CurNormal, CurResize, CurMove, CurLast };
56 /** Rule type */
57 typedef struct Rule Rule;
58 struct Rule
60 char *icon;
61 char *xprop;
62 int screen;
63 Fuzzy isfloating;
64 Fuzzy ismaster;
65 double opacity;
66 regex_t *prop_r;
67 regex_t *tags_r;
68 regex_t *xpropval_r;
69 Rule *next;
72 /** Key bindings */
73 typedef struct Key Key;
74 struct Key
76 unsigned long mod;
77 KeyCode keycode;
78 Uicb *func;
79 char *arg;
80 Key *next;
83 /** Mouse buttons bindings */
84 typedef struct Button Button;
85 struct Button
87 unsigned long mod;
88 unsigned int button;
89 Uicb *func;
90 char *arg;
91 Button *next;
94 /** Widget tell status code */
95 typedef enum
97 WIDGET_NOERROR = 0,
98 WIDGET_ERROR,
99 WIDGET_ERROR_NOVALUE,
100 WIDGET_ERROR_CUSTOM,
101 WIDGET_ERROR_FORMAT_BOOL,
102 WIDGET_ERROR_FORMAT_FONT,
103 WIDGET_ERROR_FORMAT_COLOR,
104 WIDGET_ERROR_FORMAT_SECTION
105 } widget_tell_status_t;
107 /** Widget */
108 typedef struct Widget Widget;
109 typedef struct Statusbar Statusbar;
110 struct Widget
112 /** Widget name */
113 char *name;
114 /** Draw function */
115 int (*draw)(Widget *, DrawCtx *, int, int);
116 /** Update function */
117 widget_tell_status_t (*tell)(Widget *, char *, char *);
118 /** ButtonPressedEvent handler */
119 void (*button_press)(Widget *, XButtonPressedEvent *);
120 /** Statusbar */
121 Statusbar *statusbar;
122 /** Alignement */
123 Alignment alignment;
124 /** Misc private data */
125 void *data;
126 /** True if user supplied coords */
127 Bool user_supplied_x;
128 Bool user_supplied_y;
129 /** Area */
130 Area area;
131 /** Buttons bindings */
132 Button *buttons;
133 /** Font */
134 XftFont *font;
135 /** Cache */
136 struct
138 Bool needs_update;
139 int flags;
140 } cache;
141 /** Next widget */
142 Widget *next;
145 /** Status bar */
146 struct Statusbar
148 /** Window */
149 SimpleWindow *sw;
150 /** Statusbar name */
151 char *name;
152 /** Bar width */
153 int width;
154 /** Bar height */
155 int height;
156 /** Default position */
157 Position dposition;
158 /** Bar position */
159 Position position;
160 /** Screen */
161 int screen;
162 /** Widget list */
163 Widget *widgets;
164 /** Next statusbar */
165 Statusbar *next;
168 /** Client type */
169 typedef struct Client Client;
170 struct Client
172 /** Client name */
173 char name[256];
174 /** Window geometry */
175 Area geometry;
176 /** Floating window geometry */
177 Area f_geometry;
178 /** Max window geometry */
179 Area m_geometry;
180 int basew, baseh, incw, inch, maxw, maxh, minw, minh;
181 int minax, maxax, minay, maxay;
182 int border, oldborder;
183 /** Has urgency hint */
184 Bool isurgent;
185 /** Store previous floating state before maximizing */
186 Bool wasfloating;
187 /** True if the window is floating */
188 Bool isfloating;
189 /** True if the window is fixed */
190 Bool isfixed;
191 /** True if the window is maximized */
192 Bool ismax;
193 /** True if the client must be skipped from client list */
194 Bool skip;
195 /** True if the client must be skipped from task bar client list */
196 Bool skiptb;
197 /** Next client */
198 Client *next;
199 /** Window of the client */
200 Window win;
201 /** Client logical screen */
202 int screen;
203 /** True if the client is a new one */
204 Bool newcomer;
207 typedef struct client_node_t client_node_t;
208 struct client_node_t
210 Client *client;
211 client_node_t *next;
214 /** Tag type */
215 typedef struct Tag Tag;
216 struct Tag
218 /** Tag name */
219 char *name;
220 /** Screen */
221 int screen;
222 /** True if selected */
223 Bool selected;
224 /** True if was selected before selecting others tags */
225 Bool was_selected;
226 /** Current tag layout */
227 Layout *layout;
228 /** Master width factor */
229 double mwfact;
230 /** Number of master windows */
231 int nmaster;
232 /** Number of columns in tile layout */
233 int ncol;
234 /** Next tag */
235 Tag *next;
238 /** tag_client_node type */
239 typedef struct tag_client_node_t tag_client_node_t;
240 struct tag_client_node_t
242 Tag *tag;
243 Client *client;
244 tag_client_node_t *next;
247 /** Padding type */
248 typedef struct
250 /** Padding at top */
251 int top;
252 /** Padding at bottom */
253 int bottom;
254 /** Padding at left */
255 int left;
256 /** Padding at right */
257 int right;
258 } Padding;
260 typedef Area (FloatingPlacement)(Area, int, int);
261 typedef struct
263 /** Screen geometry */
264 Area geometry;
265 /** Number of pixels to snap windows */
266 int snap;
267 /** Border size */
268 int borderpx;
269 /** Mwfact limits */
270 float mwfact_upper_limit, mwfact_lower_limit;
271 /** Floating window placement algo */
272 FloatingPlacement *floating_placement;
273 /** Respect resize hints */
274 Bool resize_hints;
275 /** Sloppy focus: focus follow mouse */
276 Bool sloppy_focus;
277 /** True if we should raise windows on focus */
278 Bool sloppy_focus_raise;
279 /** Focus new clients */
280 Bool new_get_focus;
281 /** True if new clients should become master */
282 Bool new_become_master;
283 /** True if we need to arrange() */
284 Bool need_arrange;
285 /** Normal colors */
286 XColor colors_normal[ColLast];
287 /** Selected colors */
288 XColor colors_selected[ColLast];
289 /** Urgency colors */
290 XColor colors_urgent[ColLast];
291 /** Transparency of unfocused clients */
292 int opacity_unfocused;
293 /** Tag list */
294 Tag *tags;
295 /** Layout list */
296 Layout *layouts;
297 /** Status bar */
298 Statusbar *statusbar;
299 /** Padding */
300 Padding padding;
301 /** Font */
302 XftFont *font;
303 /** Draw shadow under text */
304 int shadow_offset;
305 } VirtScreen;
307 /** Main configuration structure */
308 typedef struct AwesomeConf AwesomeConf;
309 struct AwesomeConf
311 /** Display ref */
312 Display *display;
313 /** Logical screens */
314 VirtScreen *screens;
315 /** Number of logical screens */
316 int nscreen;
317 /** Rules list */
318 Rule *rules;
319 /** Keys bindings list */
320 Key *keys;
321 /** Mouse bindings list */
322 struct
324 Button *root;
325 Button *client;
326 } buttons;
327 /** Numlock mask */
328 unsigned int numlockmask;
329 /** Check for XShape extension */
330 Bool have_shape;
331 /** Check for XRandR extension */
332 Bool have_randr;
333 /** Cursors */
334 Cursor cursor[CurLast];
335 /** Clients list */
336 Client *clients;
337 /** Scratch client */
338 struct
340 Client *client;
341 Bool isvisible;
342 } scratch;
343 /** Path to config file */
344 char *configpath;
345 /** Selected clients history */
346 client_node_t *focus;
347 /** Link between tags and clients */
348 tag_client_node_t *tclink;
349 /** Command line passed to awesome */
350 char *argv;
351 /** Last XMotionEvent coords */
352 int pointer_x, pointer_y;
355 #endif
356 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80