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 "queue.h"
16 #include "i3.h"
17 
18 typedef struct IncludedFile IncludedFile;
19 typedef struct Config Config;
20 typedef struct Barconfig Barconfig;
21 extern char *current_configpath;
22 extern char *current_config;
23 extern Config config;
24 extern SLIST_HEAD(modes_head, Mode) modes;
25 extern TAILQ_HEAD(barconfig_head, Barconfig) barconfigs;
26 extern TAILQ_HEAD(includedfiles_head, IncludedFile) included_files;
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 
78 struct IncludedFile {
79  char *path;
80  char *raw_contents;
82 
84 };
85 
92 struct Mode {
93  char *name;
95  struct bindings_head *bindings;
96 
98 };
99 
105 struct Config {
106  const char *terminal;
108 
111 
117 
120 
126 
136 
142 
148 
167 
177 
180 
183 
189 
196 
198  enum {
199  /* Focus if the target workspace is visible, set urgency hint otherwise. */
201  /* Always set the urgency hint. */
203  /* Always focus the window. */
205  /* Ignore the request (no focus, no urgency hint). */
208 
212 
214  enum {
218  } title_align;
219 
222 
225 
229 
235 
236  /* Color codes are stored here */
237  struct config_client {
244  } client;
245  struct config_bar {
249  } bar;
250 
252  enum {
253  /* display (and focus) the popup when it belongs to the fullscreen
254  * window only. */
256 
257  /* leave fullscreen mode unconditionally */
259 
260  /* just ignore the popup, that is, don’t map it */
263 
264  /* The number of currently parsed barconfigs */
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) tray_outputs;
288 
289  /* Padding around the tray icons. */
291 
295  char *socket_path;
296 
298  enum { M_DOCK = 0,
299  M_HIDE = 1,
301 
302  /* The current hidden_state of the bar, which indicates whether it is hidden or shown */
303  enum { S_HIDE = 0,
305 
307  uint32_t modifier;
308 
309  TAILQ_HEAD(bar_bindings_head, Barbinding) bar_bindings;
310 
312  enum { P_BOTTOM = 0,
314 
319 
323 
325  char *font;
326 
329 
334 
337 
341 
345 
349 
351  bool verbose;
352 
353  struct bar_colors {
354  char *background;
355  char *statusline;
356  char *separator;
357 
361 
365 
369 
373 
377 
381  } colors;
382 
383  TAILQ_ENTRY(Barconfig) configs;
384 };
385 
391 struct Barbinding {
394 
396  char *command;
397 
399  bool release;
400 
402 };
403 
405  char *output;
406 
407  TAILQ_ENTRY(tray_output_t) tray_outputs;
408 };
409 
410 typedef enum {
414 } config_load_t;
415 
427 bool load_configuration(const char *override_configfile, config_load_t load_type);
428 
434 void ungrab_all_keys(xcb_connection_t *conn);
int line_number
Definition: configuration.h:37
const char * terminal
struct Colortriple focused
color_t border
Definition: configuration.h:54
TAILQ_ENTRY(Barconfig) configs
int container_stack_limit_value
bool verbose
Enable verbose mode? Useful for debugging purposes.
char * i3bar_command
Command that should be run to execute i3bar, give a full path if i3bar is not in your $PATH...
bool disable_focus_follows_mouse
By default, focus follows mouse.
color_t child_border
Definition: configuration.h:58
bool workspace_auto_back_and_forth
Automatic workspace back and forth switching.
Used during the config file lexing/parsing to keep the state of the lexer in order to provide useful ...
Definition: configuration.h:33
char * separator_symbol
A custom separator to use instead of a vertical line.
char * key
Definition: configuration.h:67
struct Colortriple placeholder
int default_border_width
List entry struct for an included file.
Definition: configuration.h:78
struct barconfig_head barconfigs
Definition: config.c:21
SLIST_ENTRY(Variable) variables
struct includedfiles_head included_files
Definition: config.c:22
struct Colortriple unfocused
char * status_command
Command that should be run to get a statusline, for example 'i3status'.
border_style_t
Definition: data.h:62
warping_t
Mouse pointer warping modes.
Definition: data.h:131
char * raw_contents
Definition: configuration.h:80
char * socket_path
Path to the i3 IPC socket.
char * restart_state_path
int first_column
Definition: configuration.h:44
bool pango_markup
Definition: configuration.h:94
TAILQ_ENTRY(tray_output_t) tray_outputs
float workspace_urgency_timer
By default, urgency is cleared immediately when switching to another workspace leads to focusing the ...
Holds the status bar configuration (i3bar).
struct bindings_head * bindings
Definition: main.c:87
color_t background
Definition: configuration.h:55
int32_t floating_maximum_height
layout_t
Container layouts.
Definition: data.h:91
char ** outputs
Outputs on which this bar should show up on.
bool has_warnings
Definition: configuration.h:35
config_load_t
bool show_marks
Specifies whether or not marks should be displayed in the window decoration.
color_t text
Definition: configuration.h:56
SLIST_ENTRY(Mode) modes
struct modes_head modes
Definition: config.c:20
int number_barconfigs
int default_orientation
Default orientation for new containers.
int workspace_min_width
The minimal width for workspace buttons.
int32_t floating_minimum_width
struct Config::config_client client
i3Font font
Holds a user-assigned variable for parsing the configuration file.
Definition: configuration.h:66
char * name
Definition: configuration.h:93
char * font
Font specification for all text rendered on the bar.
TAILQ_HEAD(barconfig_head, Barconfig) barconfigs
bool hide_binding_mode_indicator
Hide mode button? Configuration option is 'binding_mode_indicator no' but we invert the bool for the ...
enum Config::@5 title_align
Title alignment options.
uint32_t modifier
Bar modifier (to show bar when in hide mode).
border_style_t default_floating_border
The default border style for new floating windows.
xcb_connection_t * conn
XCB connection and root screen.
Definition: main.c:54
uint32_t floating_modifier
The modifier which needs to be pressed in combination with your mouse buttons to do things with float...
struct Colortriple focused
hide_edge_borders_mode_t hide_edge_borders
Remove borders if they are adjacent to the screen edge.
focus_wrapping_t focus_wrapping
When focus wrapping is enabled (the default), attempting to move focus past the edge of the screen (i...
struct Config::config_bar bar
Part of the struct Config.
Definition: configuration.h:53
color_t indicator
Definition: configuration.h:57
TAILQ_HEAD(tray_outputs_head, tray_output_t) tray_outputs
struct Colortriple unfocused
bool disable_randr15
Don’t use RandR 1.5 for querying outputs.
struct Colortriple urgent
struct bindings_head * bindings
Definition: configuration.h:95
SLIST_HEAD(modes_head, Mode) modes
enum Barconfig::@8 hidden_state
bool force_xinerama
By default, use the RandR API for multi-monitor setups.
char * current_configpath
Definition: config.c:18
char * compact_error
Definition: configuration.h:41
int input_code
The button to be used (e.g., 1 for "button1").
int last_column
Definition: configuration.h:45
border_style_t default_border
The default border style for new 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:29
char * next_match
Definition: configuration.h:69
warping_t mouse_warping
By default, when switching focus to a window on a different output (e.g.
enum Barconfig::@9 position
Bar position (bottom by default).
Holds part of the configuration (the part which is not already in dedicated structures in include/dat...
const char * filename
Definition: configuration.h:39
TAILQ_ENTRY(Barbinding) bindings
bool strip_workspace_name
Strip workspace name? Configuration option is 'strip_workspace_name yes'.
char * command
The command which is to be executed for this button.
TAILQ_ENTRY(IncludedFile) files
bool release
If true, the command will be executed after the button is released.
hide_edge_borders_mode_t
Definition: data.h:79
int default_floating_border_width
char * current_config
char * value
Definition: configuration.h:68
Defines a mouse command to be executed instead of the default behavior when clicking on the non-statu...
int tray_padding
bool hide_workspace_buttons
Hide workspace buttons? Configuration option is 'workspace_buttons no' but we invert the bool to get ...
bool load_configuration(const char *override_configfile, config_load_t load_type)
(Re-)loads the configuration file (sets useful defaults before).
Definition: config.c:166
char * ipc_socket_path
Definition: libi3.h:420
char * id
Automatically generated ID for this bar config.
enum Config::@6 popup_during_fullscreen
What should happen when a new popup is opened during fullscreen mode.
struct Colortriple urgent
enum Config::@4 focus_on_window_activation
Behavior when a window sends a NET_ACTIVE_WINDOW message.
struct Barconfig::bar_colors colors
bool has_errors
Definition: configuration.h:34
char * line_copy
Definition: configuration.h:38
char * fake_outputs
Overwrites output detection (for testing), see src/fake_outputs.c.
int32_t floating_minimum_height
layout_t default_layout
int32_t floating_maximum_width
Maximum and minimum dimensions of a floating window.
int num_outputs
Number of outputs in the outputs array.
int container_stack_limit
char * variable_replaced_contents
Definition: configuration.h:81
bool disable_workspace_bar
By default, a workspace bar is drawn at the bottom of the screen.
focus_wrapping_t
Focus wrapping modes.
Definition: data.h:139
struct Colortriple focused_inactive
enum Barconfig::@7 mode
Bar display mode (hide unless modifier is pressed or show in dock mode or always hide in invisible mo...
Config config
Definition: config.c:19
bool strip_workspace_numbers
Strip workspace numbers? Configuration option is 'strip_workspace_numbers yes'.
Data structure for cached font information:
Definition: libi3.h:59
The configuration file can contain multiple sets of bindings.
Definition: configuration.h:92