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 
271  bool verbose;
272 
273  struct bar_colors {
274  char *background;
275  char *statusline;
276  char *separator;
277 
281 
285 
289 
293  } colors;
294 
295  TAILQ_ENTRY(Barconfig) configs;
296 };
297 
305 void load_configuration(xcb_connection_t *conn, const char *override_configfile, bool reload);
306 
311 void translate_keysyms(void);
312 
318 void ungrab_all_keys(xcb_connection_t *conn);
319 
324 void grab_all_keys(xcb_connection_t *conn, bool bind_mode_switch);
325 
330 void switch_mode(const char *new_mode);
331 void update_barconfig();
337 
343 Binding *get_binding(uint16_t modifiers, bool key_release, xcb_keycode_t keycode);
344 
354 void kill_configerror_nagbar(bool wait_for_it);
355 
356 #endif
void kill_configerror_nagbar(bool wait_for_it)
Kills the configerror i3-nagbar process, if any.
The configuration file can contain multiple sets of bindings.
Definition: config.h:79
char * font
Font specification for all text rendered on the bar.
Definition: config.h:263
border_style_t default_border
The default border style for new windows.
Definition: config.h:161
void load_configuration(xcb_connection_t *conn, const char *override_configpath, bool reload)
Reads the configuration from ~/.i3/config or /etc/i3/config if not found.
Definition: config.c:342
border_style_t
Definition: data.h:57
int container_stack_limit
Definition: config.h:99
struct modes_head modes
Definition: config.c:20
int line_number
Definition: config.h:37
int last_column
Definition: config.h:45
#define SLIST_HEAD(name, type)
Definition: queue.h:94
Config config
Definition: config.c:19
uint32_t text
Definition: config.h:56
uint32_t background
Definition: config.h:55
struct barconfig_head barconfigs
Definition: config.c:21
uint32_t background
Definition: config.h:178
const char * restart_state_path
Definition: config.h:96
bool force_focus_wrapping
Think of the following layout: Horizontal workspace with a tabbed con on the left of the screen and a...
Definition: config.h:132
char * inactive_workspace_bg
Definition: config.h:287
int container_stack_limit_value
Definition: config.h:100
adjacent_t
describes if the window is adjacent to the output (physical screen) edges.
Definition: data.h:64
bool disable_focus_follows_mouse
By default, focus follows mouse.
Definition: config.h:110
int32_t floating_maximum_width
Maximum and minimum dimensions of a floating window.
Definition: config.h:171
bool disable_workspace_bar
By default, a workspace bar is drawn at the bottom of the screen.
Definition: config.h:122
char * focused_workspace_bg
Definition: config.h:279
char * urgent_workspace_border
Definition: config.h:290
layout_t
Container layouts.
Definition: data.h:85
bool verbose
Enable verbose mode? Useful for debugging purposes.
Definition: config.h:271
char * urgent_workspace_text
Definition: config.h:292
char * urgent_workspace_bg
Definition: config.h:291
char * fake_outputs
Overwrites output detection (for testing), see src/fake_outputs.c.
Definition: config.h:145
bool force_xinerama
By default, use the RandR API for multi-monitor setups.
Definition: config.h:142
Binding * get_binding(uint16_t modifiers, bool key_release, xcb_keycode_t keycode)
Returns a pointer to the Binding with the specified modifiers and keycode or NULL if no such binding ...
Definition: config.c:58
const char * terminal
Definition: config.h:92
bool has_errors
Definition: config.h:34
float workspace_urgency_timer
By default, urgency is cleared immediately when switching to another workspace leads to focusing the ...
Definition: config.h:158
xcb_connection_t * conn
Definition: main.c:42
Holds a keybinding, consisting of a keycode combined with modifiers and the command which is executed...
Definition: data.h:216
uint32_t floating_modifier
The modifier which needs to be pressed in combination with your mouse buttons to do things with float...
Definition: config.h:168
char * active_workspace_border
Definition: config.h:282
int default_orientation
Default orientation for new containers.
Definition: config.h:104
void update_barconfig()
Sends the current bar configuration as an event to all barconfig_update listeners.
Definition: config.c:218
#define TAILQ_HEAD(name, type)
Definition: queue.h:306
char * line_copy
Definition: config.h:38
char * tray_output
Output on which the tray should be shown.
Definition: config.h:225
Holds part of the configuration (the part which is not already in dedicated structures in include/dat...
Definition: config.h:91
int first_column
Definition: config.h:44
char * id
Automatically generated ID for this bar config.
Definition: config.h:215
border_style_t default_floating_border
The default border style for new floating windows.
Definition: config.h:164
char * key
Definition: config.h:66
SLIST_ENTRY(Variable) variables
char * value
Definition: config.h:67
char * focused_workspace_text
Definition: config.h:280
uint32_t border
Definition: config.h:54
char * name
Definition: config.h:80
const char * filename
Definition: config.h:39
char * focused_workspace_border
Definition: config.h:278
int32_t floating_minimum_width
Definition: config.h:173
char * active_workspace_text
Definition: config.h:284
layout_t default_layout
Definition: config.h:98
i3Font font
Definition: config.h:93
int32_t floating_maximum_height
Definition: config.h:172
char * i3bar_command
Command that should be run to execute i3bar, give a full path if i3bar is not in your $PATH...
Definition: config.h:256
void switch_mode(const char *new_mode)
Switches the key bindings to the given mode, if the mode exists.
Definition: config.c:187
char * current_configpath
Definition: config.c:18
Con * focused
Definition: tree.c:15
char * compact_error
Definition: config.h:41
adjacent_t hide_edge_borders
Remove borders if they are adjacent to the screen edge.
Definition: config.h:116
int default_border_width
Definition: config.h:101
char * colors[]
Definition: con.c:16
uint32_t indicator
Definition: config.h:57
char * next_match
Definition: config.h:68
void translate_keysyms(void)
Translates keysymbols to keycodes for all bindings which use keysyms.
Definition: config.c:115
#define TAILQ_ENTRY(type)
Definition: queue.h:315
Part of the struct Config.
Definition: config.h:53
bool hide_workspace_buttons
Hide workspace buttons? Configuration option is &#39;workspace_buttons no&#39; but we invert the bool to get ...
Definition: config.h:268
int32_t floating_minimum_height
Definition: config.h:174
bool workspace_auto_back_and_forth
Automatic workspace back and forth switching.
Definition: config.h:151
char ** outputs
Outputs on which this bar should show up on.
Definition: config.h:221
struct bindings_head * bindings
Definition: config.h:81
int number_barconfigs
Definition: config.h:204
bool has_warnings
Definition: config.h:35
char * active_workspace_bg
Definition: config.h:283
char * inactive_workspace_text
Definition: config.h:288
Used during the config file lexing/parsing to keep the state of the lexer in order to provide useful ...
Definition: config.h:33
char * ipc_socket_path
Definition: config.h:95
void ungrab_all_keys(xcb_connection_t *conn)
Ungrabs all keys, to be called before re-grabbing the keys because of a mapping_notify event or a con...
Definition: config.c:28
char * status_command
Command that should be run to get a statusline, for example &#39;i3status&#39;.
Definition: config.h:260
Holds the status bar configuration (i3bar).
Definition: config.h:212
char * socket_path
Path to the i3 IPC socket.
Definition: config.h:230
void grab_all_keys(xcb_connection_t *conn, bool bind_mode_switch)
Grab the bound keys (tell X to send us keypress events for those keycodes)
Definition: config.c:164
char * inactive_workspace_border
Definition: config.h:286
Data structure for cached font information:
Definition: libi3.h:39
Holds a user-assigned variable for parsing the configuration file.
Definition: config.h:65
int num_outputs
Number of outputs in the outputs array.
Definition: config.h:218