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 Config Config;
19 typedef struct Barconfig Barconfig;
20 extern char *current_configpath;
21 extern char *current_config;
22 extern Config config;
23 extern SLIST_HEAD(modes_head, Mode) modes;
24 extern TAILQ_HEAD(barconfig_head, Barconfig) barconfigs;
25 
31 struct context {
32  bool has_errors;
34 
36  char *line_copy;
37  const char *filename;
38 
40 
41  /* These are the same as in YYLTYPE */
44 };
45 
51 struct Colortriple {
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;
81  struct bindings_head *bindings;
82 
84 };
85 
91 struct Config {
92  const char *terminal;
94 
97 
103 
106 
112 
122 
128 
134 
153 
163 
166 
169 
175 
182 
184  enum {
185  /* Focus if the target workspace is visible, set urgency hint otherwise. */
187  /* Always set the urgency hint. */
189  /* Always focus the window. */
191  /* Ignore the request (no focus, no urgency hint). */
192  FOWA_NONE
194 
198 
200  enum {
205 
208 
211 
215 
221 
222  /* Color codes are stored here */
223  struct config_client {
225  struct Colortriple focused;
227  struct Colortriple unfocused;
228  struct Colortriple urgent;
229  struct Colortriple placeholder;
231  struct config_bar {
232  struct Colortriple focused;
233  struct Colortriple unfocused;
234  struct Colortriple urgent;
235  } bar;
236 
238  enum {
239  /* display (and focus) the popup when it belongs to the fullscreen
240  * window only. */
242 
243  /* leave fullscreen mode unconditionally */
245 
246  /* just ignore the popup, that is, don’t map it */
249 
250  /* The number of currently parsed barconfigs */
252 
253  /* Gap sizes */
255 
256  /* Should single containers on a workspace receive a border? */
258 
259  /* Disable gaps if there is only one container on the workspace */
261 };
262 
268 struct Barconfig {
271  char *id;
272 
277  char **outputs;
278 
279  /* List of outputs on which the tray is allowed to be shown, in order.
280  * The special value "none" disables it (per default, it will be shown) and
281  * the special value "primary" enabled it on the primary output. */
282  TAILQ_HEAD(tray_outputs_head, tray_output_t) tray_outputs;
283 
284  /* Padding around the tray icons. */
286 
290  char *socket_path;
291 
293  enum { M_DOCK = 0,
294  M_HIDE = 1,
296 
297  /* The current hidden_state of the bar, which indicates whether it is hidden or shown */
298  enum { S_HIDE = 0,
300 
302  uint32_t modifier;
303 
304  TAILQ_HEAD(bar_bindings_head, Barbinding) bar_bindings;
305 
307  enum { P_BOTTOM = 0,
309 
314 
318 
320  char *font;
321 
324 
329 
332 
336 
340 
344 
346  bool verbose;
347 
349  uint32_t bar_height;
350 
351  struct bar_colors {
352  char *background;
353  char *statusline;
354  char *separator;
355 
359 
363 
367 
371 
375 
380 
382 };
383 
389 struct Barbinding {
392 
394  char *command;
395 
397  bool release;
398 
400 };
401 
403  char *output;
404 
405  TAILQ_ENTRY(tray_output_t) tray_outputs;
406 };
407 
408 typedef enum {
412 } config_load_t;
413 
425 bool load_configuration(const char *override_configfile, config_load_t load_type);
426 
432 void ungrab_all_keys(xcb_connection_t *conn);
struct barconfig_head barconfigs
Definition: config.c:19
struct modes_head modes
Definition: config.c:18
xcb_connection_t * conn
XCB connection and root screen.
Definition: main.c:51
struct bindings_head * bindings
Definition: main.c:81
SLIST_HEAD(modes_head, Mode) modes
Config config
Definition: config.c:17
TAILQ_HEAD(barconfig_head, Barconfig) barconfigs
config_load_t
@ C_VALIDATE
@ C_RELOAD
@ C_LOAD
bool load_configuration(const char *override_configfile, config_load_t load_type)
(Re-)loads the configuration file (sets useful defaults before).
Definition: config.c:163
char * current_configpath
Definition: config.c:15
char * current_config
Definition: config.c:16
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
hide_edge_borders_mode_t
Definition: data.h:87
smart_gaps_t
Definition: data.h:83
smart_borders_t
Definition: data.h:79
warping_t
Mouse pointer warping modes.
Definition: data.h:140
layout_t
Container layouts.
Definition: data.h:100
focus_wrapping_t
Focus wrapping modes.
Definition: data.h:156
border_style_t
Definition: data.h:62
Used during the config file lexing/parsing to keep the state of the lexer in order to provide useful ...
Definition: configuration.h:31
char * line_copy
Definition: configuration.h:36
bool has_warnings
Definition: configuration.h:33
int last_column
Definition: configuration.h:43
int line_number
Definition: configuration.h:35
int first_column
Definition: configuration.h:42
bool has_errors
Definition: configuration.h:32
const char * filename
Definition: configuration.h:37
char * compact_error
Definition: configuration.h:39
Part of the struct Config.
Definition: configuration.h:51
color_t border
Definition: configuration.h:52
color_t child_border
Definition: configuration.h:56
color_t indicator
Definition: configuration.h:55
color_t background
Definition: configuration.h:53
color_t text
Definition: configuration.h:54
Holds a user-assigned variable for parsing the configuration file.
Definition: configuration.h:64
char * key
Definition: configuration.h:65
char * next_match
Definition: configuration.h:67
char * value
Definition: configuration.h:66
SLIST_ENTRY(Variable) variables
The configuration file can contain multiple sets of bindings.
Definition: configuration.h:78
char * name
Definition: configuration.h:79
struct bindings_head * bindings
Definition: configuration.h:81
bool pango_markup
Definition: configuration.h:80
SLIST_ENTRY(Mode) modes
Holds part of the configuration (the part which is not already in dedicated structures in include/dat...
Definition: configuration.h:91
int container_stack_limit_value
focus_wrapping_t focus_wrapping
When focus wrapping is enabled (the default), attempting to move focus past the edge of the screen (i...
gaps_t gaps
char * restart_state_path
Definition: configuration.h:96
bool workspace_auto_back_and_forth
Automatic workspace back and forth switching.
int32_t floating_minimum_width
enum Config::@7 title_align
Title alignment options.
int default_border_width
i3Font font
Definition: configuration.h:93
hide_edge_borders_mode_t hide_edge_borders
Remove borders if they are adjacent to the screen edge.
int32_t floating_minimum_height
const char * terminal
Definition: configuration.h:92
@ ALIGN_CENTER
bool disable_focus_follows_mouse
By default, focus follows mouse.
struct Config::config_client client
warping_t mouse_warping
By default, when switching focus to a window on a different output (e.g.
smart_gaps_t smart_gaps
char * fake_outputs
Overwrites output detection (for testing), see src/fake_outputs.c.
int default_floating_border_width
int default_orientation
Default orientation for new containers.
uint32_t floating_modifier
The modifier which needs to be pressed in combination with your mouse buttons to do things with float...
char * ipc_socket_path
Definition: configuration.h:95
bool show_marks
Specifies whether or not marks should be displayed in the window decoration.
float workspace_urgency_timer
By default, urgency is cleared immediately when switching to another workspace leads to focusing the ...
int container_stack_limit
Definition: configuration.h:99
struct Config::config_bar bar
bool disable_randr15
Don’t use RandR 1.5 for querying outputs.
int32_t floating_maximum_width
Maximum and minimum dimensions of a floating window.
enum Config::@6 focus_on_window_activation
Behavior when a window sends a NET_ACTIVE_WINDOW message.
bool force_xinerama
By default, use the RandR API for multi-monitor setups.
smart_borders_t smart_borders
int32_t floating_maximum_height
@ PDF_LEAVE_FULLSCREEN
border_style_t default_border
The default border style for new windows.
bool disable_workspace_bar
By default, a workspace bar is drawn at the bottom of the screen.
layout_t default_layout
Definition: configuration.h:98
border_style_t default_floating_border
The default border style for new floating windows.
enum Config::@8 popup_during_fullscreen
What should happen when a new popup is opened during fullscreen mode.
int number_barconfigs
struct Colortriple focused
struct Colortriple placeholder
struct Colortriple unfocused
struct Colortriple urgent
struct Colortriple focused_inactive
struct Colortriple focused
struct Colortriple unfocused
struct Colortriple urgent
Holds the status bar configuration (i3bar).
bool hide_workspace_buttons
Hide workspace buttons? Configuration option is 'workspace_buttons no' but we invert the bool to get ...
char * separator_symbol
A custom separator to use instead of a vertical line.
enum Barconfig::@11 position
Bar position (bottom by default).
int workspace_min_width
The minimal width for workspace buttons.
struct Barconfig::bar_colors colors
uint32_t modifier
Bar modifier (to show bar when in hide mode).
uint32_t bar_height
Defines the height of the bar in pixels.
char * i3bar_command
Command that should be run to execute i3bar, give a full path if i3bar is not in your $PATH.
int num_outputs
Number of outputs in the outputs array.
char * font
Font specification for all text rendered on the bar.
enum Barconfig::@10 hidden_state
TAILQ_HEAD(tray_outputs_head, tray_output_t) tray_outputs
char * id
Automatically generated ID for this bar config.
TAILQ_HEAD(bar_bindings_head, Barbinding) bar_bindings
enum Barconfig::@9 mode
Bar display mode (hide unless modifier is pressed or show in dock mode or always hide in invisible mo...
bool hide_binding_mode_indicator
Hide mode button? Configuration option is 'binding_mode_indicator no' but we invert the bool for the ...
char * status_command
Command that should be run to get a statusline, for example 'i3status'.
bool strip_workspace_numbers
Strip workspace numbers? Configuration option is 'strip_workspace_numbers yes'.
bool strip_workspace_name
Strip workspace name? Configuration option is 'strip_workspace_name yes'.
int tray_padding
char ** outputs
Outputs on which this bar should show up on.
TAILQ_ENTRY(Barconfig) configs
char * socket_path
Path to the i3 IPC socket.
bool verbose
Enable verbose mode? Useful for debugging purposes.
Defines a mouse command to be executed instead of the default behavior when clicking on the non-statu...
bool release
If true, the command will be executed after the button is released.
TAILQ_ENTRY(Barbinding) bindings
int input_code
The button to be used (e.g., 1 for "button1").
char * command
The command which is to be executed for this button.
TAILQ_ENTRY(tray_output_t) tray_outputs
Definition: data.h:145
Data structure for cached font information:
Definition: libi3.h:58
Definition: libi3.h:419