2 * vim:ts=4:sw=4:expandtab
4 * i3 - an improved dynamic tiling window manager
6 * © 2009-2010 Michael Stapelberg and contributors
8 * See file LICENSE for license information.
10 * include/config.h: Contains all structs/variables for the configurable
11 * part of i3 as well as functions handling the configuration file (calling
12 * the parser (src/cfgparse.y) with the correct path, switching key bindings
24 typedef struct Config Config;
25 typedef struct Barconfig Barconfig;
26 extern char *current_configpath;
28 extern SLIST_HEAD(modes_head, Mode) modes;
29 extern TAILQ_HEAD(barconfig_head, Barconfig) barconfigs;
32 * Used during the config file lexing/parsing to keep the state of the lexer
33 * in order to provide useful error messages in yyerror().
46 /* These are the same as in YYLTYPE */
52 * Part of the struct Config. It makes sense to group colors for background,
53 * border and text as every element in i3 has them (window decorations, bar).
63 * Holds a user-assigned variable for parsing the configuration file. The key
64 * is replaced by value in every following line of the file.
72 SLIST_ENTRY(Variable) variables;
76 * The configuration file can contain multiple sets of bindings. Apart from the
77 * default set (name == "default"), you can specify other sets and change the
78 * 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 const char *restart_state_path;
101 int container_stack_limit;
102 int container_stack_limit_value;
104 /** Default orientation for new containers */
105 int default_orientation;
107 /** By default, focus follows mouse. If the user explicitly wants to
108 * turn this off (and instead rely only on the keyboard for changing
109 * focus), we allow him to do this with this relatively special option.
110 * It is not planned to add any different focus models. */
111 bool disable_focus_follows_mouse;
113 /** By default, a workspace bar is drawn at the bottom of the screen.
114 * If you want to have a more fancy bar, it is recommended to replace
115 * the whole bar by dzen2, for example using the i3-wsbar script which
116 * comes with i3. Thus, you can turn it off entirely. */
117 bool disable_workspace_bar;
119 /** Think of the following layout: Horizontal workspace with a tabbed
120 * con on the left of the screen and a terminal on the right of the
121 * screen. You are in the second container in the tabbed container and
122 * focus to the right. By default, i3 will set focus to the terminal on
123 * the right. If you are in the first container in the tabbed container
124 * however, focusing to the left will wrap. This option forces i3 to
125 * always wrap, which will result in you having to use "focus parent"
127 bool force_focus_wrapping;
129 /** By default, use the RandR API for multi-monitor setups.
130 * Unfortunately, the nVidia binary graphics driver doesn't support
131 * this API. Instead, it only support the less powerful Xinerama API,
132 * which can be enabled by this option.
134 * Note: this option takes only effect on the initial startup (eg.
135 * reconfiguration is not possible). On startup, the list of screens
136 * is fetched once and never updated. */
139 /** Automatic workspace back and forth switching. If this is set, a
140 * switch to the currently active workspace will switch to the
141 * previously focused one instead, making it possible to fast toggle
142 * between two workspaces. */
143 bool workspace_auto_back_and_forth;
145 /** The default border style for new windows. */
146 border_style_t default_border;
148 /** The default border style for new floating windows. */
149 border_style_t default_floating_border;
151 /** The modifier which needs to be pressed in combination with your mouse
152 * buttons to do things with floating windows (move, resize) */
153 uint32_t floating_modifier;
155 /* Color codes are stored here */
156 struct config_client {
158 struct Colortriple focused;
159 struct Colortriple focused_inactive;
160 struct Colortriple unfocused;
161 struct Colortriple urgent;
164 struct Colortriple focused;
165 struct Colortriple unfocused;
166 struct Colortriple urgent;
169 /** What should happen when a new popup is opened during fullscreen mode */
171 PDF_LEAVE_FULLSCREEN = 0,
173 } popup_during_fullscreen;
177 * Holds the status bar configuration (i3bar). One of these structures is
178 * created for each 'bar' block in the config.
182 /** Automatically generated ID for this bar config. Used by the bar process
183 * to request a specific configuration. */
186 /** Number of outputs in the outputs array */
188 /** Outputs on which this bar should show up on. We use an array for
189 * simplicity (since we store just strings). */
192 /** Output on which the tray should be shown. The special value of 'no'
193 * disables the tray (it’s enabled by default). */
196 /** Path to the i3 IPC socket. This option is discouraged since programs
197 * can find out the path by looking for the I3_SOCKET_PATH property on the
201 /** Bar display mode (hide unless modifier is pressed or show in dock mode) */
202 enum { M_DOCK = 0, M_HIDE = 1 } mode;
204 /** Bar position (bottom by default). */
205 enum { P_BOTTOM = 0, P_TOP = 1 } position;
207 /** Command that should be run to get a statusline, for example 'i3status'.
208 * Will be passed to the shell. */
209 char *status_command;
211 /** Font specification for all text rendered on the bar. */
214 /** Hide workspace buttons? Configuration option is 'workspace_buttons no'
215 * but we invert the bool to get the correct default when initializing with
217 bool hide_workspace_buttons;
219 /** Enable verbose mode? Useful for debugging purposes. */
226 char *focused_workspace_text;
227 char *focused_workspace_bg;
229 char *active_workspace_text;
230 char *active_workspace_bg;
232 char *inactive_workspace_text;
233 char *inactive_workspace_bg;
235 char *urgent_workspace_text;
236 char *urgent_workspace_bg;
239 TAILQ_ENTRY(Barconfig) configs;
243 * Reads the configuration from ~/.i3/config or /etc/i3/config if not found.
245 * If you specify override_configpath, only this path is used to look for a
246 * configuration file.
249 void load_configuration(xcb_connection_t *conn, const char *override_configfile, bool reload);
252 * Translates keysymbols to keycodes for all bindings which use keysyms.
255 void translate_keysyms();
258 * Ungrabs all keys, to be called before re-grabbing the keys because of a
259 * mapping_notify event or a configuration file reload
262 void ungrab_all_keys(xcb_connection_t *conn);
265 * Grab the bound keys (tell X to send us keypress events for those keycodes)
268 void grab_all_keys(xcb_connection_t *conn, bool bind_mode_switch);
271 * Switches the key bindings to the given mode, if the mode exists
274 void switch_mode(const char *new_mode);
277 * Returns a pointer to the Binding with the specified modifiers and keycode
278 * or NULL if no such binding exists.
281 Binding *get_binding(uint16_t modifiers, xcb_keycode_t keycode);
284 * Kills the configerror i3-nagbar process, if any.
286 * Called when reloading/restarting.
288 * If wait_for_it is set (restarting), this function will waitpid(), otherwise,
289 * ev is assumed to handle it (reloading).
292 void kill_configerror_nagbar(bool wait_for_it);
294 /* prototype for src/cfgparse.y */
295 void parse_file(const char *f);