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 SLIST_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().
45 /* These are the same as in YYLTYPE */
51 * Part of the struct Config. It makes sense to group colors for background,
52 * 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.
82 struct bindings_head *bindings;
84 SLIST_ENTRY(Mode) modes;
88 * Holds part of the configuration (the part which is not already in dedicated
89 * structures in include/data.h).
96 char *ipc_socket_path;
97 const char *restart_state_path;
100 int container_stack_limit;
101 int container_stack_limit_value;
103 /** Default orientation for new containers */
104 int default_orientation;
106 /** By default, focus follows mouse. If the user explicitly wants to
107 * turn this off (and instead rely only on the keyboard for changing
108 * focus), we allow him to do this with this relatively special option.
109 * It is not planned to add any different focus models. */
110 bool disable_focus_follows_mouse;
112 /** By default, a workspace bar is drawn at the bottom of the screen.
113 * If you want to have a more fancy bar, it is recommended to replace
114 * the whole bar by dzen2, for example using the i3-wsbar script which
115 * comes with i3. Thus, you can turn it off entirely. */
116 bool disable_workspace_bar;
118 /** Think of the following layout: Horizontal workspace with a tabbed
119 * con on the left of the screen and a terminal on the right of the
120 * screen. You are in the second container in the tabbed container and
121 * focus to the right. By default, i3 will set focus to the terminal on
122 * the right. If you are in the first container in the tabbed container
123 * however, focusing to the left will wrap. This option forces i3 to
124 * always wrap, which will result in you having to use "focus parent"
126 bool force_focus_wrapping;
128 /** By default, use the RandR API for multi-monitor setups.
129 * Unfortunately, the nVidia binary graphics driver doesn't support
130 * this API. Instead, it only support the less powerful Xinerama API,
131 * which can be enabled by this option.
133 * Note: this option takes only effect on the initial startup (eg.
134 * reconfiguration is not possible). On startup, the list of screens
135 * is fetched once and never updated. */
138 /** Automatic workspace back and forth switching. If this is set, a
139 * switch to the currently active workspace will switch to the
140 * previously focused one instead, making it possible to fast toggle
141 * between two workspaces. */
142 bool workspace_auto_back_and_forth;
144 /** The default border style for new windows. */
145 border_style_t default_border;
147 /** The default border style for new floating windows. */
148 border_style_t default_floating_border;
150 /** The modifier which needs to be pressed in combination with your mouse
151 * buttons to do things with floating windows (move, resize) */
152 uint32_t floating_modifier;
154 /* Color codes are stored here */
155 struct config_client {
157 struct Colortriple focused;
158 struct Colortriple focused_inactive;
159 struct Colortriple unfocused;
160 struct Colortriple urgent;
163 struct Colortriple focused;
164 struct Colortriple unfocused;
165 struct Colortriple urgent;
168 /** What should happen when a new popup is opened during fullscreen mode */
170 PDF_LEAVE_FULLSCREEN = 0,
172 } popup_during_fullscreen;
176 * Holds the status bar configuration (i3bar). One of these structures is
177 * created for each 'bar' block in the config.
181 /** Automatically generated ID for this bar config. Used by the bar process
182 * to request a specific configuration. */
185 /** Number of outputs in the outputs array */
187 /** Outputs on which this bar should show up on. We use an array for
188 * simplicity (since we store just strings). */
191 /** Output on which the tray should be shown. The special value of 'no'
192 * disables the tray (it’s enabled by default). */
195 /** Path to the i3 IPC socket. This option is discouraged since programs
196 * can find out the path by looking for the I3_SOCKET_PATH property on the
200 /** Bar display mode (hide unless modifier is pressed or show in dock mode) */
201 enum { M_HIDE = 0, M_DOCK = 1 } mode;
203 /** Bar position (bottom by default). */
204 enum { P_BOTTOM = 0, P_TOP = 1 } position;
206 /** Command that should be run to get a statusline, for example 'i3status'.
207 * Will be passed to the shell. */
208 char *status_command;
210 /** Font specification for all text rendered on the bar. */
213 /** Hide workspace buttons? Configuration option is 'workspace_buttons no'
214 * but we invert the bool to get the correct default when initializing with
216 bool hide_workspace_buttons;
218 /** Enable verbose mode? Useful for debugging purposes. */
225 char *focused_workspace_text;
226 char *focused_workspace_bg;
228 char *active_workspace_text;
229 char *active_workspace_bg;
231 char *inactive_workspace_text;
232 char *inactive_workspace_bg;
234 char *urgent_workspace_text;
235 char *urgent_workspace_bg;
238 SLIST_ENTRY(Barconfig) configs;
242 * Reads the configuration from ~/.i3/config or /etc/i3/config if not found.
244 * If you specify override_configpath, only this path is used to look for a
245 * configuration file.
248 void load_configuration(xcb_connection_t *conn, const char *override_configfile, bool reload);
251 * Translates keysymbols to keycodes for all bindings which use keysyms.
254 void translate_keysyms();
257 * Ungrabs all keys, to be called before re-grabbing the keys because of a
258 * mapping_notify event or a configuration file reload
261 void ungrab_all_keys(xcb_connection_t *conn);
264 * Grab the bound keys (tell X to send us keypress events for those keycodes)
267 void grab_all_keys(xcb_connection_t *conn, bool bind_mode_switch);
270 * Switches the key bindings to the given mode, if the mode exists
273 void switch_mode(const char *new_mode);
276 * Returns a pointer to the Binding with the specified modifiers and keycode
277 * or NULL if no such binding exists.
280 Binding *get_binding(uint16_t modifiers, xcb_keycode_t keycode);
283 * Kills the configerror i3-nagbar process, if any.
285 * Called when reloading/restarting.
287 * If wait_for_it is set (restarting), this function will waitpid(), otherwise,
288 * ev is assumed to handle it (reloading).
291 void kill_configerror_nagbar(bool wait_for_it);
293 /* prototype for src/cfgparse.y */
294 void parse_file(const char *f);