i3
config.h
Go to the documentation of this file.
1 /*
2  * vim:ts=4:sw=4:expandtab
3  *
4  * i3 - an improved dynamic tiling window manager
5  * © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE)
6  *
7  * include/config.h: Contains all structs/variables for the configurable
8  * part of i3 as well as functions handling the configuration file (calling
9  * the parser (src/cfgparse.y) with the correct path, switching key bindings
10  * mode).
11  *
12  */
13 #ifndef _CONFIG_H
14 #define _CONFIG_H
15 
16 #include <stdbool.h>
17 #include "queue.h"
18 #include "i3.h"
19 #include "libi3.h"
20 
21 typedef struct Config Config;
22 typedef struct Barconfig Barconfig;
23 extern char *current_configpath;
24 extern Config config;
25 extern SLIST_HEAD(modes_head, Mode) modes;
26 extern TAILQ_HEAD(barconfig_head, Barconfig) barconfigs;
27 
33 struct context {
34  bool has_errors;
36 
38  char *line_copy;
39  const char *filename;
40 
42 
43  /* These are the same as in YYLTYPE */
46 };
47 
53 struct Colortriple {
54  uint32_t border;
55  uint32_t background;
56  uint32_t text;
57  uint32_t indicator;
58 };
59 
65 struct Variable {
66  char *key;
67  char *value;
68  char *next_match;
69 
70  SLIST_ENTRY(Variable) variables;
71 };
72 
79 struct Mode {
80  char *name;
81  struct bindings_head *bindings;
82 
83  SLIST_ENTRY(Mode) modes;
84 };
85 
91 struct Config {
92  const char *terminal;
94 
96  const char *restart_state_path;
97 
101 
104 
110 
116 
122 
132 
142 
145 
151 
154 
157 
161 
167 
168  /* Color codes are stored here */
169  struct config_client {
170  uint32_t background;
172  struct Colortriple focused_inactive;
173  struct Colortriple unfocused;
174  struct Colortriple urgent;
175  } client;
176  struct config_bar {
178  struct Colortriple unfocused;
179  struct Colortriple urgent;
180  } bar;
181 
183  enum {
184  PDF_LEAVE_FULLSCREEN = 0,
185  PDF_IGNORE = 1
186  } popup_during_fullscreen;
187 };
188 
194 struct Barconfig {
197  char *id;
198 
203  char **outputs;
204 
207  char *tray_output;
208 
212  char *socket_path;
213 
215  enum { M_DOCK = 0, M_HIDE = 1 } mode;
216 
218  enum {
219  M_NONE = 0,
220  M_CONTROL = 1,
221  M_SHIFT = 2,
222  M_MOD1 = 3,
223  M_MOD2 = 4,
224  M_MOD3 = 5,
225  M_MOD4 = 6,
226  M_MOD5 = 7
227  } modifier;
228 
230  enum { P_BOTTOM = 0, P_TOP = 1 } position;
231 
236 
240 
242  char *font;
243 
248 
250  bool verbose;
251 
252  struct bar_colors {
253  char *background;
254  char *statusline;
255 
259 
263 
267 
271  } colors;
272 
273  TAILQ_ENTRY(Barconfig) configs;
274 };
275 
283 void load_configuration(xcb_connection_t *conn, const char *override_configfile, bool reload);
284 
289 void translate_keysyms(void);
290 
296 void ungrab_all_keys(xcb_connection_t *conn);
297 
302 void grab_all_keys(xcb_connection_t *conn, bool bind_mode_switch);
303 
308 void switch_mode(const char *new_mode);
309 
315 Binding *get_binding(uint16_t modifiers, bool key_release, xcb_keycode_t keycode);
316 
326 void kill_configerror_nagbar(bool wait_for_it);
327 
328 /* prototype for src/cfgparse.y */
329 void parse_file(const char *f);
330 
331 #endif