i3
include/config.h
Go to the documentation of this file.
00001 /*
00002  * vim:ts=8:expandtab
00003  *
00004  * i3 - an improved dynamic tiling window manager
00005  *
00006  * © 2009-2010 Michael Stapelberg and contributors
00007  *
00008  * See file LICENSE for license information.
00009  *
00010  * include/config.h: Contains all structs/variables for the configurable
00011  * part of i3 as well as functions handling the configuration file (calling
00012  * the parser (src/cfgparse.y) with the correct path, switching key bindings
00013  * mode).
00014  *
00015  */
00016 
00017 #ifndef _CONFIG_H
00018 #define _CONFIG_H
00019 
00020 #include <stdbool.h>
00021 #include "queue.h"
00022 #include "i3.h"
00023 
00024 typedef struct Config Config;
00025 extern Config config;
00026 extern SLIST_HEAD(modes_head, Mode) modes;
00027 
00033 struct context {
00034         int line_number;
00035         char *line_copy;
00036         const char *filename;
00037 
00038         /* These are the same as in YYLTYPE */
00039         int first_column;
00040         int last_column;
00041 };
00042 
00048 struct Colortriple {
00049         uint32_t border;
00050         uint32_t background;
00051         uint32_t text;
00052 };
00053 
00059 struct Variable {
00060         char *key;
00061         char *value;
00062         char *next_match;
00063 
00064         SLIST_ENTRY(Variable) variables;
00065 };
00066 
00073 struct Mode {
00074         char *name;
00075         struct bindings_head *bindings;
00076 
00077         SLIST_ENTRY(Mode) modes;
00078 };
00079 
00085 struct Config {
00086         const char *terminal;
00087         const char *font;
00088 
00089         const char *ipc_socket_path;
00090 
00091         int container_mode;
00092         int container_stack_limit;
00093         int container_stack_limit_value;
00094 
00099         bool disable_focus_follows_mouse;
00100 
00105         bool disable_workspace_bar;
00106 
00107         const char *default_border;
00108 
00111         uint32_t floating_modifier;
00112 
00113         /* Color codes are stored here */
00114         struct config_client {
00115                 uint32_t background;
00116                 struct Colortriple focused;
00117                 struct Colortriple focused_inactive;
00118                 struct Colortriple unfocused;
00119                 struct Colortriple urgent;
00120         } client;
00121         struct config_bar {
00122                 struct Colortriple focused;
00123                 struct Colortriple unfocused;
00124                 struct Colortriple urgent;
00125         } bar;
00126 };
00127 
00132 char *glob_path(const char *path);
00133 
00138 bool path_exists(const char *path);
00139 
00147 void load_configuration(xcb_connection_t *conn, const char *override_configfile, bool reload);
00148 
00153 void translate_keysyms();
00154 
00160 void ungrab_all_keys(xcb_connection_t *conn);
00161 
00166 void grab_all_keys(xcb_connection_t *conn, bool bind_mode_switch);
00167 
00172 void switch_mode(xcb_connection_t *conn, const char *new_mode);
00173 
00179 Binding *get_binding(uint16_t modifiers, xcb_keycode_t keycode);
00180 
00181 /* prototype for src/cfgparse.y */
00182 void parse_file(const char *f);
00183 
00184 #endif