i3
|
00001 /* 00002 * vim:ts=4:sw=4:expandtab 00003 * 00004 * i3 - an improved dynamic tiling window manager 00005 * © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE) 00006 * 00007 * include/config.h: Contains all structs/variables for the configurable 00008 * part of i3 as well as functions handling the configuration file (calling 00009 * the parser (src/cfgparse.y) with the correct path, switching key bindings 00010 * mode). 00011 * 00012 */ 00013 #ifndef _CONFIG_H 00014 #define _CONFIG_H 00015 00016 #include <stdbool.h> 00017 #include "queue.h" 00018 #include "i3.h" 00019 #include "libi3.h" 00020 00021 typedef struct Config Config; 00022 typedef struct Barconfig Barconfig; 00023 extern char *current_configpath; 00024 extern Config config; 00025 extern SLIST_HEAD(modes_head, Mode) modes; 00026 extern TAILQ_HEAD(barconfig_head, Barconfig) barconfigs; 00027 00033 struct context { 00034 bool has_errors; 00035 bool has_warnings; 00036 00037 int line_number; 00038 char *line_copy; 00039 const char *filename; 00040 00041 char *compact_error; 00042 00043 /* These are the same as in YYLTYPE */ 00044 int first_column; 00045 int last_column; 00046 }; 00047 00053 struct Colortriple { 00054 uint32_t border; 00055 uint32_t background; 00056 uint32_t text; 00057 uint32_t indicator; 00058 }; 00059 00065 struct Variable { 00066 char *key; 00067 char *value; 00068 char *next_match; 00069 00070 SLIST_ENTRY(Variable) variables; 00071 }; 00072 00079 struct Mode { 00080 char *name; 00081 struct bindings_head *bindings; 00082 00083 SLIST_ENTRY(Mode) modes; 00084 }; 00085 00091 struct Config { 00092 const char *terminal; 00093 i3Font font; 00094 00095 char *ipc_socket_path; 00096 const char *restart_state_path; 00097 00098 int default_layout; 00099 int container_stack_limit; 00100 int container_stack_limit_value; 00101 00103 int default_orientation; 00104 00109 bool disable_focus_follows_mouse; 00110 00115 bool disable_workspace_bar; 00116 00125 bool force_focus_wrapping; 00126 00135 bool force_xinerama; 00136 00138 char *fake_outputs; 00139 00144 bool workspace_auto_back_and_forth; 00145 00147 border_style_t default_border; 00148 00150 border_style_t default_floating_border; 00151 00154 uint32_t floating_modifier; 00155 00157 int32_t floating_maximum_width; 00158 int32_t floating_maximum_height; 00159 int32_t floating_minimum_width; 00160 int32_t floating_minimum_height; 00161 00162 /* Color codes are stored here */ 00163 struct config_client { 00164 uint32_t background; 00165 struct Colortriple focused; 00166 struct Colortriple focused_inactive; 00167 struct Colortriple unfocused; 00168 struct Colortriple urgent; 00169 } client; 00170 struct config_bar { 00171 struct Colortriple focused; 00172 struct Colortriple unfocused; 00173 struct Colortriple urgent; 00174 } bar; 00175 00177 enum { 00178 PDF_LEAVE_FULLSCREEN = 0, 00179 PDF_IGNORE = 1 00180 } popup_during_fullscreen; 00181 }; 00182 00188 struct Barconfig { 00191 char *id; 00192 00194 int num_outputs; 00197 char **outputs; 00198 00201 char *tray_output; 00202 00206 char *socket_path; 00207 00209 enum { M_DOCK = 0, M_HIDE = 1 } mode; 00210 00212 enum { 00213 M_NONE = 0, 00214 M_CONTROL = 1, 00215 M_SHIFT = 2, 00216 M_MOD1 = 3, 00217 M_MOD2 = 4, 00218 M_MOD3 = 5, 00219 M_MOD4 = 6, 00220 M_MOD5 = 7 00221 } modifier; 00222 00224 enum { P_BOTTOM = 0, P_TOP = 1 } position; 00225 00229 char *i3bar_command; 00230 00233 char *status_command; 00234 00236 char *font; 00237 00241 bool hide_workspace_buttons; 00242 00244 bool verbose; 00245 00246 struct bar_colors { 00247 char *background; 00248 char *statusline; 00249 00250 char *focused_workspace_border; 00251 char *focused_workspace_bg; 00252 char *focused_workspace_text; 00253 00254 char *active_workspace_border; 00255 char *active_workspace_bg; 00256 char *active_workspace_text; 00257 00258 char *inactive_workspace_border; 00259 char *inactive_workspace_bg; 00260 char *inactive_workspace_text; 00261 00262 char *urgent_workspace_border; 00263 char *urgent_workspace_bg; 00264 char *urgent_workspace_text; 00265 } colors; 00266 00267 TAILQ_ENTRY(Barconfig) configs; 00268 }; 00269 00277 void load_configuration(xcb_connection_t *conn, const char *override_configfile, bool reload); 00278 00283 void translate_keysyms(void); 00284 00290 void ungrab_all_keys(xcb_connection_t *conn); 00291 00296 void grab_all_keys(xcb_connection_t *conn, bool bind_mode_switch); 00297 00302 void switch_mode(const char *new_mode); 00303 00309 Binding *get_binding(uint16_t modifiers, xcb_keycode_t keycode); 00310 00320 void kill_configerror_nagbar(bool wait_for_it); 00321 00322 /* prototype for src/cfgparse.y */ 00323 void parse_file(const char *f); 00324 00325 #endif