i3
configuration.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 Michael Stapelberg and contributors (see also: LICENSE)
6  *
7  * include/configuration.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 "libi3.h"
16 
17 #include <stdbool.h>
18 #include "queue.h"
19 #include "i3.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 {
59 };
60 
66 struct Variable {
67  char *key;
68  char *value;
69  char *next_match;
70 
71  SLIST_ENTRY(Variable) variables;
72 };
73 
80 struct Mode {
81  char *name;
83  struct bindings_head *bindings;
84 
85  SLIST_ENTRY(Mode) modes;
86 };
87 
93 struct Config {
94  const char *terminal;
96 
99 
105 
108 
114 
124 
130 
136 
146 
156 
159 
165 
172 
174  enum {
175  /* Focus if the target workspace is visible, set urgency hint otherwise. */
177  /* Always set the urgency hint. */
179  /* Always focus the window. */
181  /* Ignore the request (no focus, no urgency hint). */
182  FOWA_NONE
183  } focus_on_window_activation;
184 
188 
191 
194 
198 
204 
205  /* Color codes are stored here */
206  struct config_client {
209  struct Colortriple focused_inactive;
210  struct Colortriple unfocused;
211  struct Colortriple urgent;
212  struct Colortriple placeholder;
213  } client;
214  struct config_bar {
216  struct Colortriple unfocused;
217  struct Colortriple urgent;
218  } bar;
219 
221  enum {
222  /* display (and focus) the popup when it belongs to the fullscreen
223  * window only. */
224  PDF_SMART = 0,
225 
226  /* leave fullscreen mode unconditionally */
227  PDF_LEAVE_FULLSCREEN = 1,
228 
229  /* just ignore the popup, that is, don’t map it */
230  PDF_IGNORE = 2,
231  } popup_during_fullscreen;
232 
233  /* The number of currently parsed barconfigs */
235 };
236 
242 struct Barconfig {
245  char *id;
246 
251  char **outputs;
252 
253  /* List of outputs on which the tray is allowed to be shown, in order.
254  * The special value "none" disables it (per default, it will be shown) and
255  * the special value "primary" enabled it on the primary output. */
256  TAILQ_HEAD(tray_outputs_head, tray_output_t) tray_outputs;
257 
258  /* Padding around the tray icons. */
259  int tray_padding;
260 
264  char *socket_path;
265 
267  enum { M_DOCK = 0,
268  M_HIDE = 1,
269  M_INVISIBLE = 2 } mode;
270 
271  /* The current hidden_state of the bar, which indicates whether it is hidden or shown */
272  enum { S_HIDE = 0,
273  S_SHOW = 1 } hidden_state;
274 
276  enum {
277  M_NONE = 0,
278  M_CONTROL = 1,
279  M_SHIFT = 2,
280  M_MOD1 = 3,
281  M_MOD2 = 4,
282  M_MOD3 = 5,
283  M_MOD4 = 6,
284  M_MOD5 = 7
285  } modifier;
286 
287  TAILQ_HEAD(bar_bindings_head, Barbinding) bar_bindings;
288 
290  enum { P_BOTTOM = 0,
291  P_TOP = 1 } position;
292 
297 
301 
303  char *font;
304 
307 
312 
316 
320 
322  bool verbose;
323 
324  struct bar_colors {
325  char *background;
326  char *statusline;
327  char *separator;
328 
332 
336 
340 
344 
348 
352  } colors;
353 
354  TAILQ_ENTRY(Barconfig) configs;
355 };
356 
362 struct Barbinding {
365 
367  char *command;
368 
369  TAILQ_ENTRY(Barbinding) bindings;
370 };
371 
373  char *output;
374 
375  TAILQ_ENTRY(tray_output_t) tray_outputs;
376 };
377 
390 bool parse_configuration(const char *override_configpath, bool use_nagbar);
391 
399 void load_configuration(xcb_connection_t *conn, const char *override_configfile, bool reload);
400 
406 void ungrab_all_keys(xcb_connection_t *conn);
407 
412 void update_barconfig();
413 
423 void kill_configerror_nagbar(bool wait_for_it);
Data structure for cached font information:
Definition: libi3.h:48
int line_number
Definition: configuration.h:37
char * status_command
Command that should be run to get a statusline, for example &#39;i3status&#39;.
bool has_errors
Definition: configuration.h:34
Definition: libi3.h:392
bool force_focus_wrapping
Think of the following layout: Horizontal workspace with a tabbed con on the left of the screen and a...
hide_edge_borders_mode_t
Definition: data.h:79
char * command
The command which is to be executed for this button.
border_style_t default_border
The default border style for new windows.
bool show_marks
Specifies whether or not marks should be displayed in the window decoration.
char ** outputs
Outputs on which this bar should show up on.
The configuration file can contain multiple sets of bindings.
Definition: configuration.h:80
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:47
border_style_t default_floating_border
The default border style for new floating windows.
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:25
#define SLIST_ENTRY(type)
Definition: queue.h:101
struct bindings_head * bindings
Definition: configuration.h:83
char * name
Definition: configuration.h:81
char * line_copy
Definition: configuration.h:38
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:71
layout_t default_layout
void kill_configerror_nagbar(bool wait_for_it)
Kills the configerror i3-nagbar process, if any.
bool disable_workspace_bar
By default, a workspace bar is drawn at the bottom of the screen.
color_t child_border
Definition: configuration.h:58
int default_border_width
bool strip_workspace_numbers
Strip workspace numbers? Configuration option is &#39;strip_workspace_numbers yes&#39;.
border_style_t
Definition: data.h:62
Config config
Definition: config.c:16
bool force_xinerama
By default, use the RandR API for multi-monitor setups.
int container_stack_limit
struct modes_head modes
Definition: config.c:17
bool hide_binding_mode_indicator
Hide mode button? Configuration option is &#39;binding_mode_indicator no&#39; but we invert the bool for the ...
char * value
Definition: configuration.h:68
int32_t floating_minimum_height
uint32_t floating_modifier
The modifier which needs to be pressed in combination with your mouse buttons to do things with float...
bool hide_workspace_buttons
Hide workspace buttons? Configuration option is &#39;workspace_buttons no&#39; but we invert the bool to get ...
hide_edge_borders_mode_t hide_edge_borders
Remove borders if they are adjacent to the screen edge.
bool verbose
Enable verbose mode? Useful for debugging purposes.
color_t indicator
Definition: configuration.h:57
const char * filename
Definition: configuration.h:39
bool pango_markup
Definition: configuration.h:82
void update_barconfig()
Sends the current bar configuration as an event to all barconfig_update listeners.
Definition: config.c:34
int default_floating_border_width
SLIST_HEAD(modes_head, Mode) modes
bool disable_focus_follows_mouse
By default, focus follows mouse.
int32_t floating_maximum_height
Holds the status bar configuration (i3bar).
char * restart_state_path
Definition: configuration.h:98
Used during the config file lexing/parsing to keep the state of the lexer in order to provide useful ...
Definition: configuration.h:33
int first_column
Definition: configuration.h:44
char * fake_outputs
Overwrites output detection (for testing), see src/fake_outputs.c.
int input_code
The button to be used (e.g., 1 for "button1").
struct barconfig_head barconfigs
Definition: config.c:18
TAILQ_HEAD(barconfig_head, Barconfig) barconfigs
char * key
Definition: configuration.h:67
float workspace_urgency_timer
By default, urgency is cleared immediately when switching to another workspace leads to focusing the ...
Part of the struct Config.
Definition: configuration.h:53
int32_t floating_minimum_width
color_t background
Definition: configuration.h:55
i3Font font
Definition: configuration.h:95
layout_t
Container layouts.
Definition: data.h:91
bool workspace_auto_back_and_forth
Automatic workspace back and forth switching.
xcb_connection_t * conn
XCB connection and root screen.
Definition: main.c:42
warping_t
Mouse pointer warping modes.
Definition: data.h:131
#define TAILQ_ENTRY(type)
Definition: queue.h:327
char * font
Font specification for all text rendered on the bar.
int number_barconfigs
int last_column
Definition: configuration.h:45
int default_orientation
Default orientation for new containers.
bool has_warnings
Definition: configuration.h:35
int container_stack_limit_value
Con * focused
Definition: tree.c:13
int32_t floating_maximum_width
Maximum and minimum dimensions of a floating window.
char * current_configpath
Definition: config.c:15
int num_outputs
Number of outputs in the outputs array.
color_t border
Definition: configuration.h:54
char * next_match
Definition: configuration.h:69
Holds part of the configuration (the part which is not already in dedicated structures in include/dat...
Definition: configuration.h:93
Defines a mouse command to be executed instead of the default behavior when clicking on the non-statu...
char * compact_error
Definition: configuration.h:41
const char * terminal
Definition: configuration.h:94
char * i3bar_command
Command that should be run to execute i3bar, give a full path if i3bar is not in your $PATH...
char * separator_symbol
A custom separator to use instead of a vertical line.
char * id
Automatically generated ID for this bar config.
Holds a user-assigned variable for parsing the configuration file.
Definition: configuration.h:66
warping_t mouse_warping
By default, when switching focus to a window on a different output (e.g.
color_t text
Definition: configuration.h:56
char * ipc_socket_path
Definition: configuration.h:97