2 * vim:ts=4:sw=4:expandtab
4 * i3 - an improved dynamic tiling window manager
5 * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
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
21 typedef struct Config Config;
22 typedef struct Barconfig Barconfig;
23 extern char *current_configpath;
25 extern SLIST_HEAD(modes_head, Mode) modes;
26 extern TAILQ_HEAD(barconfig_head, Barconfig) barconfigs;
29 * Used during the config file lexing/parsing to keep the state of the lexer
30 * in order to provide useful error messages in yyerror().
43 /* These are the same as in YYLTYPE */
49 * Part of the struct Config. It makes sense to group colors for background,
50 * border and text as every element in i3 has them (window decorations, bar).
62 * Holds a user-assigned variable for parsing the configuration file. The key
63 * is replaced by value in every following line of the file.
71 SLIST_ENTRY(Variable) variables;
75 * The configuration file can contain multiple sets of bindings. Apart from the
76 * default set (name == "default"), you can specify other sets and change the
77 * currently active set of bindings by using the "mode <name>" command.
83 struct bindings_head *bindings;
85 SLIST_ENTRY(Mode) modes;
89 * Holds part of the configuration (the part which is not already in dedicated
90 * structures in include/data.h).
97 char *ipc_socket_path;
98 char *restart_state_path;
100 layout_t default_layout;
101 int container_stack_limit;
102 int container_stack_limit_value;
103 int default_border_width;
104 int default_floating_border_width;
106 /** Default orientation for new containers */
107 int default_orientation;
109 /** By default, focus follows mouse. If the user explicitly wants to
110 * turn this off (and instead rely only on the keyboard for changing
111 * focus), we allow them to do this with this relatively special option.
112 * It is not planned to add any different focus models. */
113 bool disable_focus_follows_mouse;
115 /** By default, when switching focus to a window on a different output
116 * (e.g. focusing a window on workspace 3 on output VGA-1, coming from
117 * workspace 2 on LVDS-1), the mouse cursor is warped to the center of
120 * With the mouse_warping option, you can control when the mouse cursor
121 * should be warped. "none" disables warping entirely, whereas "output"
122 * is the default behavior described above. */
123 warping_t mouse_warping;
125 /** Remove borders if they are adjacent to the screen edge.
126 * This is useful if you are reaching scrollbar on the edge of the
127 * screen or do not want to waste a single pixel of displayspace.
128 * By default, this is disabled. */
129 hide_edge_borders_mode_t hide_edge_borders;
131 /** By default, a workspace bar is drawn at the bottom of the screen.
132 * If you want to have a more fancy bar, it is recommended to replace
133 * the whole bar by dzen2, for example using the i3-wsbar script which
134 * comes with i3. Thus, you can turn it off entirely. */
135 bool disable_workspace_bar;
137 /** Think of the following layout: Horizontal workspace with a tabbed
138 * con on the left of the screen and a terminal on the right of the
139 * screen. You are in the second container in the tabbed container and
140 * focus to the right. By default, i3 will set focus to the terminal on
141 * the right. If you are in the first container in the tabbed container
142 * however, focusing to the left will wrap. This option forces i3 to
143 * always wrap, which will result in you having to use "focus parent"
145 bool force_focus_wrapping;
147 /** By default, use the RandR API for multi-monitor setups.
148 * Unfortunately, the nVidia binary graphics driver doesn't support
149 * this API. Instead, it only support the less powerful Xinerama API,
150 * which can be enabled by this option.
152 * Note: this option takes only effect on the initial startup (eg.
153 * reconfiguration is not possible). On startup, the list of screens
154 * is fetched once and never updated. */
157 /** Overwrites output detection (for testing), see src/fake_outputs.c */
160 /** Automatic workspace back and forth switching. If this is set, a
161 * switch to the currently active workspace will switch to the
162 * previously focused one instead, making it possible to fast toggle
163 * between two workspaces. */
164 bool workspace_auto_back_and_forth;
166 /** By default, urgency is cleared immediately when switching to another
167 * workspace leads to focusing the con with the urgency hint. When having
168 * multiple windows on that workspace, the user needs to guess which
169 * application raised the event. To prevent this, the reset of the urgency
170 * flag can be delayed using an urgency timer. */
171 float workspace_urgency_timer;
173 /** Behavior when a window sends a NET_ACTIVE_WINDOW message. */
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). */
183 } focus_on_window_activation;
185 /** Specifies whether or not marks should be displayed in the window
186 * decoration. Marks starting with a "_" will be ignored either way. */
189 /** The default border style for new windows. */
190 border_style_t default_border;
192 /** The default border style for new floating windows. */
193 border_style_t default_floating_border;
195 /** The modifier which needs to be pressed in combination with your mouse
196 * buttons to do things with floating windows (move, resize) */
197 uint32_t floating_modifier;
199 /** Maximum and minimum dimensions of a floating window */
200 int32_t floating_maximum_width;
201 int32_t floating_maximum_height;
202 int32_t floating_minimum_width;
203 int32_t floating_minimum_height;
205 /* Color codes are stored here */
206 struct config_client {
208 struct Colortriple focused;
209 struct Colortriple focused_inactive;
210 struct Colortriple unfocused;
211 struct Colortriple urgent;
212 struct Colortriple placeholder;
215 struct Colortriple focused;
216 struct Colortriple unfocused;
217 struct Colortriple urgent;
220 /** What should happen when a new popup is opened during fullscreen mode */
222 /* display (and focus) the popup when it belongs to the fullscreen
226 /* leave fullscreen mode unconditionally */
227 PDF_LEAVE_FULLSCREEN = 1,
229 /* just ignore the popup, that is, don’t map it */
231 } popup_during_fullscreen;
233 /* The number of currently parsed barconfigs */
234 int number_barconfigs;
238 * Holds the status bar configuration (i3bar). One of these structures is
239 * created for each 'bar' block in the config.
243 /** Automatically generated ID for this bar config. Used by the bar process
244 * to request a specific configuration. */
247 /** Number of outputs in the outputs array */
249 /** Outputs on which this bar should show up on. We use an array for
250 * simplicity (since we store just strings). */
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;
258 /* Padding around the tray icons. */
261 /** Path to the i3 IPC socket. This option is discouraged since programs
262 * can find out the path by looking for the I3_SOCKET_PATH property on the
266 /** Bar display mode (hide unless modifier is pressed or show in dock mode or always hide in invisible mode) */
269 M_INVISIBLE = 2 } mode;
271 /* The current hidden_state of the bar, which indicates whether it is hidden or shown */
273 S_SHOW = 1 } hidden_state;
275 /** Bar modifier (to show bar when in hide mode). */
287 TAILQ_HEAD(bar_bindings_head, Barbinding) bar_bindings;
289 /** Bar position (bottom by default). */
291 P_TOP = 1 } position;
293 /** Command that should be run to execute i3bar, give a full path if i3bar is not
295 * By default just 'i3bar' is executed. */
298 /** Command that should be run to get a statusline, for example 'i3status'.
299 * Will be passed to the shell. */
300 char *status_command;
302 /** Font specification for all text rendered on the bar. */
305 /** A custom separator to use instead of a vertical line. */
306 char *separator_symbol;
308 /** Hide workspace buttons? Configuration option is 'workspace_buttons no'
309 * but we invert the bool to get the correct default when initializing with
311 bool hide_workspace_buttons;
313 /** Strip workspace numbers? Configuration option is
314 * 'strip_workspace_numbers yes'. */
315 bool strip_workspace_numbers;
317 /** Hide mode button? Configuration option is 'binding_mode_indicator no'
318 * but we invert the bool for the same reason as hide_workspace_buttons.*/
319 bool hide_binding_mode_indicator;
321 /** Enable verbose mode? Useful for debugging purposes. */
329 char *focused_background;
330 char *focused_statusline;
331 char *focused_separator;
333 char *focused_workspace_border;
334 char *focused_workspace_bg;
335 char *focused_workspace_text;
337 char *active_workspace_border;
338 char *active_workspace_bg;
339 char *active_workspace_text;
341 char *inactive_workspace_border;
342 char *inactive_workspace_bg;
343 char *inactive_workspace_text;
345 char *urgent_workspace_border;
346 char *urgent_workspace_bg;
347 char *urgent_workspace_text;
349 char *binding_mode_border;
350 char *binding_mode_bg;
351 char *binding_mode_text;
354 TAILQ_ENTRY(Barconfig) configs;
358 * Defines a mouse command to be executed instead of the default behavior when
359 * clicking on the non-statusline part of i3bar.
363 /** The button to be used (e.g., 1 for "button1"). */
366 /** The command which is to be executed for this button. */
369 TAILQ_ENTRY(Barbinding) bindings;
372 struct tray_output_t {
375 TAILQ_ENTRY(tray_output_t) tray_outputs;
379 * Finds the configuration file to use (either the one specified by
380 * override_configpath), the user’s one or the system default) and calls
383 * If you specify override_configpath, only this path is used to look for a
384 * configuration file.
386 * If use_nagbar is false, don't try to start i3-nagbar but log the errors to
387 * stdout/stderr instead.
390 bool parse_configuration(const char *override_configpath, bool use_nagbar);
393 * Reads the configuration from ~/.i3/config or /etc/i3/config if not found.
395 * If you specify override_configpath, only this path is used to look for a
396 * configuration file.
399 void load_configuration(xcb_connection_t *conn, const char *override_configfile, bool reload);
402 * Ungrabs all keys, to be called before re-grabbing the keys because of a
403 * mapping_notify event or a configuration file reload
406 void ungrab_all_keys(xcb_connection_t *conn);
409 * Sends the current bar configuration as an event to all barconfig_update listeners.
412 void update_barconfig();
415 * Kills the configerror i3-nagbar process, if any.
417 * Called when reloading/restarting.
419 * If wait_for_it is set (restarting), this function will waitpid(), otherwise,
420 * ev is assumed to handle it (reloading).
423 void kill_configerror_nagbar(bool wait_for_it);