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 #pragma once
14 
15 #include <stdbool.h>
16 #include "queue.h"
17 #include "i3.h"
18 #include "libi3.h"
19 
20 typedef struct Config Config;
21 typedef struct Barconfig Barconfig;
22 extern char *current_configpath;
23 extern Config config;
24 extern SLIST_HEAD(modes_head, Mode) modes;
25 extern TAILQ_HEAD(barconfig_head, Barconfig) barconfigs;
26 
32 struct context {
33  bool has_errors;
35 
37  char *line_copy;
38  const char *filename;
39 
41 
42  /* These are the same as in YYLTYPE */
45 };
46 
52 struct Colortriple {
53  uint32_t border;
54  uint32_t background;
55  uint32_t text;
56  uint32_t indicator;
57 };
58 
64 struct Variable {
65  char *key;
66  char *value;
67  char *next_match;
68 
69  SLIST_ENTRY(Variable) variables;
70 };
71 
78 struct Mode {
79  char *name;
80  struct bindings_head *bindings;
81 
82  SLIST_ENTRY(Mode) modes;
83 };
84 
90 struct Config {
91  const char *terminal;
93 
95  const char *restart_state_path;
96 
102 
105 
111 
121 
127 
133 
143 
153 
156 
162 
169 
172 
175 
179 
185 
186  /* Color codes are stored here */
187  struct config_client {
188  uint32_t background;
190  struct Colortriple focused_inactive;
191  struct Colortriple unfocused;
192  struct Colortriple urgent;
193  struct Colortriple placeholder;
194  } client;
195  struct config_bar {
197  struct Colortriple unfocused;
198  struct Colortriple urgent;
199  } bar;
200 
202  enum {
203  /* display (and focus) the popup when it belongs to the fullscreen
204  * window only. */
205  PDF_SMART = 0,
206 
207  /* leave fullscreen mode unconditionally */
208  PDF_LEAVE_FULLSCREEN = 1,
209 
210  /* just ignore the popup, that is, don’t map it */
211  PDF_IGNORE = 2,
212  } popup_during_fullscreen;
213 
214  /* The number of currently parsed barconfigs */
216 };
217 
223 struct Barconfig {
226  char *id;
227 
232  char **outputs;
233 
236  char *tray_output;
237 
241  char *socket_path;
242 
244  enum { M_DOCK = 0, M_HIDE = 1, M_INVISIBLE = 2 } mode;
245 
246  /* The current hidden_state of the bar, which indicates whether it is hidden or shown */
247  enum { S_HIDE = 0, S_SHOW = 1 } hidden_state;
248 
250  enum {
251  M_NONE = 0,
252  M_CONTROL = 1,
253  M_SHIFT = 2,
254  M_MOD1 = 3,
255  M_MOD2 = 4,
256  M_MOD3 = 5,
257  M_MOD4 = 6,
258  M_MOD5 = 7
259  } modifier;
260 
262  enum { P_BOTTOM = 0, P_TOP = 1 } position;
263 
268 
272 
274  char *font;
275 
280 
284 
288 
290  bool verbose;
291 
292  struct bar_colors {
293  char *background;
294  char *statusline;
295  char *separator;
296 
300 
304 
308 
312  } colors;
313 
314  TAILQ_ENTRY(Barconfig) configs;
315 };
316 
324 void load_configuration(xcb_connection_t *conn, const char *override_configfile, bool reload);
325 
331 void ungrab_all_keys(xcb_connection_t *conn);
332 
337 void update_barconfig();
338 
348 void kill_configerror_nagbar(bool wait_for_it);
char * font
Font specification for all text rendered on the bar.
Definition: config.h:274
char * name
Definition: config.h:79
Holds a user-assigned variable for parsing the configuration file.
Definition: config.h:64
int line_number
Definition: config.h:36
uint32_t text
Definition: config.h:55
Config config
Definition: config.c:19
xcb_connection_t * conn
Definition: main.c:47
int default_floating_border_width
Definition: config.h:101
bool hide_binding_mode_indicator
Hide mode button? Configuration option is &#39;binding_mode_indicator no&#39; but we invert the bool for the ...
Definition: config.h:287
border_style_t
Definition: data.h:56
int32_t floating_minimum_width
Definition: config.h:183
bool disable_focus_follows_mouse
By default, focus follows mouse.
Definition: config.h:110
i3Font font
Definition: config.h:92
uint32_t background
Definition: config.h:54
int32_t floating_maximum_height
Definition: config.h:182
warping_t
Mouse pointer warping modes.
Definition: data.h:105
char * inactive_workspace_bg
Definition: config.h:306
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:129
int number_barconfigs
Definition: config.h:215
char * fake_outputs
Overwrites output detection (for testing), see src/fake_outputs.c.
Definition: config.h:155
char * focused_workspace_bg
Definition: config.h:298
char * urgent_workspace_border
Definition: config.h:309
int32_t floating_maximum_width
Maximum and minimum dimensions of a floating window.
Definition: config.h:181
bool verbose
Enable verbose mode? Useful for debugging purposes.
Definition: config.h:290
Data structure for cached font information:
Definition: libi3.h:38
char * urgent_workspace_text
Definition: config.h:311
char * urgent_workspace_bg
Definition: config.h:310
float workspace_urgency_timer
By default, urgency is cleared immediately when switching to another workspace leads to focusing the ...
Definition: config.h:168
bool workspace_auto_back_and_forth
Automatic workspace back and forth switching.
Definition: config.h:161
layout_t
Container layouts.
Definition: data.h:84
const char * terminal
Definition: config.h:91
char * value
Definition: config.h:66
void update_barconfig()
Sends the current bar configuration as an event to all barconfig_update listeners.
Definition: config.c:37
int default_orientation
Default orientation for new containers.
Definition: config.h:104
const char * filename
Definition: config.h:38
int container_stack_limit_value
Definition: config.h:99
char * active_workspace_border
Definition: config.h:301
char * line_copy
Definition: config.h:37
void kill_configerror_nagbar(bool wait_for_it)
Kills the configerror i3-nagbar process, if any.
struct bindings_head * bindings
Definition: config.h:80
The configuration file can contain multiple sets of bindings.
Definition: config.h:78
int first_column
Definition: config.h:43
char * tray_output
Output on which the tray should be shown.
Definition: config.h:236
char * key
Definition: config.h:65
Con * focused
Definition: tree.c:15
bool has_errors
Definition: config.h:33
char * id
Automatically generated ID for this bar config.
Definition: config.h:226
Used during the config file lexing/parsing to keep the state of the lexer in order to provide useful ...
Definition: config.h:32
uint32_t background
Definition: config.h:188
warping_t mouse_warping
By default, when switching focus to a window on a different output (e.g.
Definition: config.h:120
struct modes_head modes
Definition: config.c:20
char * focused_workspace_text
Definition: config.h:299
char * ipc_socket_path
Definition: config.h:94
uint32_t border
Definition: config.h:53
SLIST_ENTRY(Variable) variables
char * focused_workspace_border
Definition: config.h:297
char * compact_error
Definition: config.h:40
char * active_workspace_text
Definition: config.h:303
adjacent_t hide_edge_borders
Remove borders if they are adjacent to the screen edge.
Definition: config.h:126
bool strip_workspace_numbers
Strip workspace numbers? Configuration option is &#39;strip_workspace_numbers yes&#39;.
Definition: config.h:283
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 * i3bar_command
Command that should be run to execute i3bar, give a full path if i3bar is not in your $PATH...
Definition: config.h:267
const char * restart_state_path
Definition: config.h:95
#define TAILQ_ENTRY(type)
Definition: queue.h:314
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:142
char * current_configpath
Definition: config.c:18
Holds part of the configuration (the part which is not already in dedicated structures in include/dat...
Definition: config.h:90
border_style_t default_border
The default border style for new windows.
Definition: config.h:171
bool disable_workspace_bar
By default, a workspace bar is drawn at the bottom of the screen.
Definition: config.h:132
uint32_t indicator
Definition: config.h:56
int default_border_width
Definition: config.h:100
bool force_xinerama
By default, use the RandR API for multi-monitor setups.
Definition: config.h:152
border_style_t default_floating_border
The default border style for new floating windows.
Definition: config.h:174
Part of the struct Config.
Definition: config.h:52
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:279
adjacent_t
describes if the window is adjacent to the output (physical screen) edges.
Definition: data.h:63
int last_column
Definition: config.h:44
struct barconfig_head barconfigs
Definition: config.c:21
#define SLIST_HEAD(name, type)
Definition: queue.h:93
char ** outputs
Outputs on which this bar should show up on.
Definition: config.h:232
int32_t floating_minimum_height
Definition: config.h:184
layout_t default_layout
Definition: config.h:97
char * next_match
Definition: config.h:67
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:178
char * active_workspace_bg
Definition: config.h:302
char * inactive_workspace_text
Definition: config.h:307
char * status_command
Command that should be run to get a statusline, for example &#39;i3status&#39;.
Definition: config.h:271
Holds the status bar configuration (i3bar).
Definition: config.h:223
char * colors[]
Definition: con.c:16
char * socket_path
Path to the i3 IPC socket.
Definition: config.h:241
bool has_warnings
Definition: config.h:34
char * inactive_workspace_border
Definition: config.h:305
#define TAILQ_HEAD(name, type)
Definition: queue.h:305
int container_stack_limit
Definition: config.h:98
int num_outputs
Number of outputs in the outputs array.
Definition: config.h:229