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/config_parse.c) with the correct path, switching key
10  * bindings mode).
11  *
12  */
13 #ifndef I3_CONFIG_H
14 #define I3_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 
102 
105 
111 
117 
123 
133 
143 
146 
152 
159 
162 
165 
169 
175 
176  /* Color codes are stored here */
177  struct config_client {
178  uint32_t background;
180  struct Colortriple focused_inactive;
181  struct Colortriple unfocused;
182  struct Colortriple urgent;
183  } client;
184  struct config_bar {
186  struct Colortriple unfocused;
187  struct Colortriple urgent;
188  } bar;
189 
191  enum {
192  /* display (and focus) the popup when it belongs to the fullscreen
193  * window only. */
194  PDF_SMART = 0,
195 
196  /* leave fullscreen mode unconditionally */
197  PDF_LEAVE_FULLSCREEN = 1,
198 
199  /* just ignore the popup, that is, don’t map it */
200  PDF_IGNORE = 2,
201  } popup_during_fullscreen;
202 
203  /* The number of currently parsed barconfigs */
205 };
206 
212 struct Barconfig {
215  char *id;
216 
221  char **outputs;
222 
225  char *tray_output;
226 
230  char *socket_path;
231 
233  enum { M_DOCK = 0, M_HIDE = 1, M_INVISIBLE = 2 } mode;
234 
235  /* The current hidden_state of the bar, which indicates whether it is hidden or shown */
236  enum { S_HIDE = 0, S_SHOW = 1 } hidden_state;
237 
239  enum {
240  M_NONE = 0,
241  M_CONTROL = 1,
242  M_SHIFT = 2,
243  M_MOD1 = 3,
244  M_MOD2 = 4,
245  M_MOD3 = 5,
246  M_MOD4 = 6,
247  M_MOD5 = 7
248  } modifier;
249 
251  enum { P_BOTTOM = 0, P_TOP = 1 } position;
252 
257 
261 
263  char *font;
264 
269 
273 
275  bool verbose;
276 
277  struct bar_colors {
278  char *background;
279  char *statusline;
280  char *separator;
281 
285 
289 
293 
297  } colors;
298 
299  TAILQ_ENTRY(Barconfig) configs;
300 };
301 
309 void load_configuration(xcb_connection_t *conn, const char *override_configfile, bool reload);
310 
315 void translate_keysyms(void);
316 
322 void ungrab_all_keys(xcb_connection_t *conn);
323 
328 void grab_all_keys(xcb_connection_t *conn, bool bind_mode_switch);
329 
334 void switch_mode(const char *new_mode);
335 void update_barconfig();
341 
347 Binding *get_binding(uint16_t modifiers, bool key_release, xcb_keycode_t keycode);
348 
358 void kill_configerror_nagbar(bool wait_for_it);
359 
360 #endif