i3
|
00001 /* 00002 * vim:ts=4:sw=4:expandtab 00003 * 00004 * i3 - an improved dynamic tiling window manager 00005 * © 2009-2011 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 }; 00058 00064 struct Variable { 00065 char *key; 00066 char *value; 00067 char *next_match; 00068 00069 SLIST_ENTRY(Variable) variables; 00070 }; 00071 00078 struct Mode { 00079 char *name; 00080 struct bindings_head *bindings; 00081 00082 SLIST_ENTRY(Mode) modes; 00083 }; 00084 00090 struct Config { 00091 const char *terminal; 00092 i3Font font; 00093 00094 char *ipc_socket_path; 00095 const char *restart_state_path; 00096 00097 int default_layout; 00098 int container_stack_limit; 00099 int container_stack_limit_value; 00100 00102 int default_orientation; 00103 00108 bool disable_focus_follows_mouse; 00109 00114 bool disable_workspace_bar; 00115 00124 bool force_focus_wrapping; 00125 00134 bool force_xinerama; 00135 00140 bool workspace_auto_back_and_forth; 00141 00143 border_style_t default_border; 00144 00146 border_style_t default_floating_border; 00147 00150 uint32_t floating_modifier; 00151 00152 /* Color codes are stored here */ 00153 struct config_client { 00154 uint32_t background; 00155 struct Colortriple focused; 00156 struct Colortriple focused_inactive; 00157 struct Colortriple unfocused; 00158 struct Colortriple urgent; 00159 } client; 00160 struct config_bar { 00161 struct Colortriple focused; 00162 struct Colortriple unfocused; 00163 struct Colortriple urgent; 00164 } bar; 00165 00167 enum { 00168 PDF_LEAVE_FULLSCREEN = 0, 00169 PDF_IGNORE = 1 00170 } popup_during_fullscreen; 00171 }; 00172 00178 struct Barconfig { 00181 char *id; 00182 00184 int num_outputs; 00187 char **outputs; 00188 00191 char *tray_output; 00192 00196 char *socket_path; 00197 00199 enum { M_DOCK = 0, M_HIDE = 1 } mode; 00200 00202 enum { P_BOTTOM = 0, P_TOP = 1 } position; 00203 00206 char *status_command; 00207 00209 char *font; 00210 00214 bool hide_workspace_buttons; 00215 00217 bool verbose; 00218 00219 struct bar_colors { 00220 char *background; 00221 char *statusline; 00222 00223 char *focused_workspace_text; 00224 char *focused_workspace_bg; 00225 00226 char *active_workspace_text; 00227 char *active_workspace_bg; 00228 00229 char *inactive_workspace_text; 00230 char *inactive_workspace_bg; 00231 00232 char *urgent_workspace_text; 00233 char *urgent_workspace_bg; 00234 } colors; 00235 00236 TAILQ_ENTRY(Barconfig) configs; 00237 }; 00238 00246 void load_configuration(xcb_connection_t *conn, const char *override_configfile, bool reload); 00247 00252 void translate_keysyms(); 00253 00259 void ungrab_all_keys(xcb_connection_t *conn); 00260 00265 void grab_all_keys(xcb_connection_t *conn, bool bind_mode_switch); 00266 00271 void switch_mode(const char *new_mode); 00272 00278 Binding *get_binding(uint16_t modifiers, xcb_keycode_t keycode); 00279 00289 void kill_configerror_nagbar(bool wait_for_it); 00290 00291 /* prototype for src/cfgparse.y */ 00292 void parse_file(const char *f); 00293 00294 #endif