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 char *current_config;
25 extern Config config;
26 extern SLIST_HEAD(modes_head, Mode) modes;
27 extern TAILQ_HEAD(barconfig_head, Barconfig) barconfigs;
28 
34 struct context {
35  bool has_errors;
37 
39  char *line_copy;
40  const char *filename;
41 
43 
44  /* These are the same as in YYLTYPE */
47 };
48 
54 struct Colortriple {
60 };
61 
67 struct Variable {
68  char *key;
69  char *value;
70  char *next_match;
71 
74 };
75 
82 struct Mode {
83  char *name;
85  struct bindings_head *bindings;
86 
89 };
90 
96 struct Config {
97  const char *terminal;
99 
102 
108 
111 
117 
127 
133 
139 
158 
168 
171 
174 
180 
187 
189  enum {
190  /* Focus if the target workspace is visible, set urgency hint otherwise. */
192  /* Always set the urgency hint. */
194  /* Always focus the window. */
196  /* Ignore the request (no focus, no urgency hint). */
197  FOWA_NONE
198  } focus_on_window_activation;
199 
203 
205  enum {
208  ALIGN_RIGHT
209  } title_align;
210 
213 
216 
220 
226 
227  /* Color codes are stored here */
228  struct config_client {
231  struct Colortriple focused_inactive;
232  struct Colortriple unfocused;
233  struct Colortriple urgent;
234  struct Colortriple placeholder;
235  } client;
236  struct config_bar {
238  struct Colortriple unfocused;
239  struct Colortriple urgent;
240  } bar;
241 
243  enum {
244  /* display (and focus) the popup when it belongs to the fullscreen
245  * window only. */
246  PDF_SMART = 0,
247 
248  /* leave fullscreen mode unconditionally */
249  PDF_LEAVE_FULLSCREEN = 1,
250 
251  /* just ignore the popup, that is, don’t map it */
252  PDF_IGNORE = 2,
253  } popup_during_fullscreen;
254 
255  /* The number of currently parsed barconfigs */
257 
258  /* Gap sizes */
260 
261  /* Should single containers on a workspace receive a border? */
263 
264  /* Disable gaps if there is only one container on the workspace */
266 };
267 
273 struct Barconfig {
276  char *id;
277 
282  char **outputs;
283 
284  /* List of outputs on which the tray is allowed to be shown, in order.
285  * The special value "none" disables it (per default, it will be shown) and
286  * the special value "primary" enabled it on the primary output. */
287  TAILQ_HEAD(tray_outputs_head, tray_output_t)
288  tray_outputs;
289 
290  /* Padding around the tray icons. */
291  int tray_padding;
292 
296  char *socket_path;
297 
299  enum { M_DOCK = 0,
300  M_HIDE = 1,
301  M_INVISIBLE = 2 } mode;
302 
303  /* The current hidden_state of the bar, which indicates whether it is hidden or shown */
304  enum { S_HIDE = 0,
305  S_SHOW = 1 } hidden_state;
306 
308  uint32_t modifier;
309 
310  TAILQ_HEAD(bar_bindings_head, Barbinding)
311  bar_bindings;
312 
314  enum { P_BOTTOM = 0,
315  P_TOP = 1 } position;
316 
321 
325 
327  char *font;
328 
331 
336 
340 
344 
348 
350  bool verbose;
351 
353  uint32_t bar_height;
354 
355  struct bar_colors {
356  char *background;
357  char *statusline;
358  char *separator;
359 
363 
367 
371 
375 
379 
383  } colors;
384 
386  configs;
387 };
388 
394 struct Barbinding {
397 
399  char *command;
400 
402  bool release;
403 
406 };
407 
409  char *output;
410 
412  tray_outputs;
413 };
414 
415 typedef enum {
419 } config_load_t;
420 
432 bool load_configuration(const char *override_configfile, config_load_t load_type);
433 
439 void ungrab_all_keys(xcb_connection_t *conn);
440 
445 void update_barconfig(void);
int container_stack_limit
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.
const char * filename
Definition: configuration.h:40
Defines a mouse command to be executed instead of the default behavior when clicking on the non-statu...
bool strip_workspace_name
Strip workspace name? Configuration option is 'strip_workspace_name yes'.
int input_code
The button to be used (e.g., 1 for "button1").
char ** outputs
Outputs on which this bar should show up on.
struct barconfig_head barconfigs
Definition: config.c:19
char * id
Automatically generated ID for this bar config.
bool hide_binding_mode_indicator
Hide mode button? Configuration option is 'binding_mode_indicator no' but we invert the bool for the ...
const char * terminal
Definition: configuration.h:97
uint32_t bar_height
Defines the height of the bar in pixels.
bool workspace_auto_back_and_forth
Automatic workspace back and forth switching.
border_style_t
Definition: data.h:63
warping_t
Mouse pointer warping modes.
Definition: data.h:141
char * ipc_socket_path
bool hide_workspace_buttons
Hide workspace buttons? Configuration option is 'workspace_buttons no' but we invert the bool to get ...
color_t indicator
Definition: configuration.h:58
bool release
If true, the command will be executed after the button is released.
xcb_connection_t * conn
XCB connection and root screen.
Definition: main.c:44
char * restart_state_path
uint32_t modifier
Bar modifier (to show bar when in hide mode).
bool strip_workspace_numbers
Strip workspace numbers? Configuration option is 'strip_workspace_numbers yes'.
uint32_t floating_modifier
The modifier which needs to be pressed in combination with your mouse buttons to do things with float...
i3Font font
Definition: configuration.h:98
layout_t
Container layouts.
Definition: data.h:101
char * next_match
Definition: configuration.h:70
struct bindings_head * bindings
Definition: main.c:74
config_load_t
char * status_command
Command that should be run to get a statusline, for example 'i3status'.
int num_outputs
Number of outputs in the outputs array.
float workspace_urgency_timer
By default, urgency is cleared immediately when switching to another workspace leads to focusing the ...
struct modes_head modes
Definition: config.c:18
Holds a user-assigned variable for parsing the configuration file.
Definition: configuration.h:67
Definition: data.h:146
char * fake_outputs
Overwrites output detection (for testing), see src/fake_outputs.c.
int first_column
Definition: configuration.h:45
bool disable_focus_follows_mouse
By default, focus follows mouse.
TAILQ_HEAD(barconfig_head, Barconfig) barconfigs
bool force_xinerama
By default, use the RandR API for multi-monitor setups.
focus_wrapping_t focus_wrapping
When focus wrapping is enabled (the default), attempting to move focus past the edge of the screen (i...
Holds part of the configuration (the part which is not already in dedicated structures in include/dat...
Definition: configuration.h:96
char * value
Definition: configuration.h:69
int32_t floating_maximum_width
Maximum and minimum dimensions of a floating window.
int32_t floating_minimum_width
Definition: libi3.h:415
char * key
Definition: configuration.h:68
color_t border
Definition: configuration.h:55
int default_floating_border_width
bool disable_randr15
Don’t use RandR 1.5 for querying outputs.
smart_borders_t
Definition: data.h:80
char * line_copy
Definition: configuration.h:39
#define TAILQ_ENTRY(type)
Definition: queue.h:327
char * font
Font specification for all text rendered on the bar.
int last_column
Definition: configuration.h:46
bool pango_markup
Definition: configuration.h:84
char * command
The command which is to be executed for this button.
border_style_t default_floating_border
The default border style for new floating windows.
SLIST_HEAD(modes_head, Mode) modes
bool has_warnings
Definition: configuration.h:36
Part of the struct Config.
Definition: configuration.h:54
layout_t default_layout
char * current_configpath
Definition: config.c:15
bool disable_workspace_bar
By default, a workspace bar is drawn at the bottom of the screen.
char * name
Definition: configuration.h:83
bool has_errors
Definition: configuration.h:35
#define SLIST_ENTRY(type)
Definition: queue.h:101
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
struct Con * focused
Definition: tree.c:13
bool verbose
Enable verbose mode? Useful for debugging purposes.
int32_t floating_minimum_height
char * compact_error
Definition: configuration.h:42
int32_t floating_maximum_height
int number_barconfigs
The configuration file can contain multiple sets of bindings.
Definition: configuration.h:82
color_t background
Definition: configuration.h:56
bool show_marks
Specifies whether or not marks should be displayed in the window decoration.
Used during the config file lexing/parsing to keep the state of the lexer in order to provide useful ...
Definition: configuration.h:34
hide_edge_borders_mode_t
Definition: data.h:88
int default_orientation
Default orientation for new containers.
color_t child_border
Definition: configuration.h:59
gaps_t gaps
warping_t mouse_warping
By default, when switching focus to a window on a different output (e.g.
int container_stack_limit_value
smart_gaps_t smart_gaps
char * current_config
Definition: config.c:16
smart_gaps_t
Definition: data.h:84
bool load_configuration(const char *override_configfile, config_load_t load_type)
(Re-)loads the configuration file (sets useful defaults before).
Definition: config.c:174
border_style_t default_border
The default border style for new windows.
hide_edge_borders_mode_t hide_edge_borders
Remove borders if they are adjacent to the screen edge.
int default_border_width
void update_barconfig(void)
Sends the current bar configuration as an event to all barconfig_update listeners.
Definition: config.c:35
Holds the status bar configuration (i3bar).
Data structure for cached font information:
Definition: libi3.h:58
focus_wrapping_t
Focus wrapping modes.
Definition: data.h:157
int line_number
Definition: configuration.h:38
struct bindings_head * bindings
Definition: configuration.h:85
Config config
Definition: config.c:17
smart_borders_t smart_borders
color_t text
Definition: configuration.h:57