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,
245  M_HIDE = 1,
246  M_INVISIBLE = 2 } mode;
247 
248  /* The current hidden_state of the bar, which indicates whether it is hidden or shown */
249  enum { S_HIDE = 0,
250  S_SHOW = 1 } hidden_state;
251 
253  enum {
254  M_NONE = 0,
255  M_CONTROL = 1,
256  M_SHIFT = 2,
257  M_MOD1 = 3,
258  M_MOD2 = 4,
259  M_MOD3 = 5,
260  M_MOD4 = 6,
261  M_MOD5 = 7
262  } modifier;
263 
267 
271 
273  enum { P_BOTTOM = 0,
274  P_TOP = 1 } position;
275 
280 
284 
286  char *font;
287 
290 
295 
299 
303 
305  bool verbose;
306 
307  struct bar_colors {
308  char *background;
309  char *statusline;
310  char *separator;
311 
315 
319 
323 
327  } colors;
328 
329  TAILQ_ENTRY(Barconfig) configs;
330 };
331 
344 bool parse_configuration(const char *override_configpath, bool use_nagbar);
345 
353 void load_configuration(xcb_connection_t *conn, const char *override_configfile, bool reload);
354 
360 void ungrab_all_keys(xcb_connection_t *conn);
361 
366 void update_barconfig();
367 
377 void kill_configerror_nagbar(bool wait_for_it);
char * font
Font specification for all text rendered on the bar.
Definition: config.h:286
void load_configuration(xcb_connection_t *conn, const char *override_configfile, bool reload)
Reads the configuration from ~/.i3/config or /etc/i3/config if not found.
Definition: config.c:134
char * name
Definition: config.h:79
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:26
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
xcb_connection_t * conn
Definition: main.c:43
void update_barconfig()
Sends the current bar configuration as an event to all barconfig_update listeners.
Definition: config.c:35
int default_floating_border_width
Definition: config.h:101
bool hide_binding_mode_indicator
Hide mode button? Configuration option is 'binding_mode_indicator no' but we invert the bool for the ...
Definition: config.h:302
border_style_t
Definition: data.h:60
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:113
bool parse_configuration(const char *override_configpath, bool use_nagbar)
Finds the configuration file to use (either the one specified by override_configpath), the user’s one or the system default) and calls parse_file().
Definition: config.c:115
char * inactive_workspace_bg
Definition: config.h:321
int number_barconfigs
Definition: config.h:215
Config config
Definition: config.c:17
char * fake_outputs
Overwrites output detection (for testing), see src/fake_outputs.c.
Definition: config.h:155
char * focused_workspace_bg
Definition: config.h:313
char * urgent_workspace_border
Definition: config.h:324
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:305
Data structure for cached font information:
Definition: libi3.h:38
char * urgent_workspace_text
Definition: config.h:326
char * urgent_workspace_bg
Definition: config.h:325
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:92
const char * terminal
Definition: config.h:91
char * value
Definition: config.h:66
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:316
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 * wheel_up_cmd
Command that should be run when mouse wheel up button is pressed over i3bar to override the default b...
Definition: config.h:266
char * key
Definition: config.h:65
char * wheel_down_cmd
Command that should be run when mouse wheel down button is pressed over i3bar to override the default...
Definition: config.h:270
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:18
char * focused_workspace_text
Definition: config.h:314
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:312
char * compact_error
Definition: config.h:40
char * active_workspace_text
Definition: config.h:318
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 'strip_workspace_numbers yes'.
Definition: config.h:298
TAILQ_HEAD(barconfig_head, Barconfig) barconfigs
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:279
char * separator_symbol
A custom separator to use instead of a vertical line.
Definition: config.h:289
const char * restart_state_path
Definition: config.h:95
#define TAILQ_ENTRY(type)
Definition: queue.h:327
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
SLIST_HEAD(modes_head, Mode) modes
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 'workspace_buttons no' but we invert the bool to get ...
Definition: config.h:294
adjacent_t
describes if the window is adjacent to the output (physical screen) edges.
Definition: data.h:71
int last_column
Definition: config.h:44
struct barconfig_head barconfigs
Definition: config.c:19
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:317
char * inactive_workspace_text
Definition: config.h:322
char * status_command
Command that should be run to get a statusline, for example 'i3status'.
Definition: config.h:283
Holds the status bar configuration (i3bar).
Definition: config.h:223
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:320
char * current_configpath
Definition: config.c:16
int container_stack_limit
Definition: config.h:98
int num_outputs
Number of outputs in the outputs array.
Definition: config.h:229