]> git.sur5r.net Git - i3/i3/blob - include/config.h
3080c5c37e05aa85b8af5b5980253b6b2c11fb97
[i3/i3] / include / config.h
1 /*
2  * vim:ts=8:expandtab
3  *
4  * i3 - an improved dynamic tiling window manager
5  *
6  * © 2009 Michael Stapelberg and contributors
7  *
8  * See file LICENSE for license information.
9  *
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
13  * mode).
14  *
15  */
16
17 #ifndef _CONFIG_H
18 #define _CONFIG_H
19
20 #include <stdbool.h>
21 #include "queue.h"
22 #include "i3.h"
23
24 typedef struct Config Config;
25 extern Config config;
26 extern SLIST_HEAD(modes_head, Mode) modes;
27
28 /**
29  * Part of the struct Config. It makes sense to group colors for background,
30  * border and text as every element in i3 has them (window decorations, bar).
31  *
32  */
33 struct Colortriple {
34         uint32_t border;
35         uint32_t background;
36         uint32_t text;
37 };
38
39 /**
40  * Holds a user-assigned variable for parsing the configuration file. The key
41  * is replaced by value in every following line of the file.
42  *
43  */
44 struct Variable {
45         char *key;
46         char *value;
47         char *next_match;
48
49         SLIST_ENTRY(Variable) variables;
50 };
51
52 /**
53  * The configuration file can contain multiple sets of bindings. Apart from the
54  * default set (name == "default"), you can specify other sets and change the
55  * currently active set of bindings by using the "mode <name>" command.
56  *
57  */
58 struct Mode {
59         char *name;
60         struct bindings_head *bindings;
61
62         SLIST_ENTRY(Mode) modes;
63 };
64
65 /**
66  * Holds part of the configuration (the part which is not already in dedicated
67  * structures in include/data.h).
68  *
69  */
70 struct Config {
71         const char *terminal;
72         const char *font;
73
74         const char *ipc_socket_path;
75
76         int container_mode;
77         int container_stack_limit;
78         int container_stack_limit_value;
79
80         const char *default_border;
81
82         /** The modifier which needs to be pressed in combination with your mouse
83          * buttons to do things with floating windows (move, resize) */
84         uint32_t floating_modifier;
85
86         /* Color codes are stored here */
87         struct config_client {
88                 struct Colortriple focused;
89                 struct Colortriple focused_inactive;
90                 struct Colortriple unfocused;
91                 struct Colortriple urgent;
92         } client;
93         struct config_bar {
94                 struct Colortriple focused;
95                 struct Colortriple unfocused;
96                 struct Colortriple urgent;
97         } bar;
98 };
99
100 /**
101  * Reads the configuration from ~/.i3/config or /etc/i3/config if not found.
102  *
103  * If you specify override_configpath, only this path is used to look for a
104  * configuration file.
105  *
106  */
107 void load_configuration(xcb_connection_t *conn, const char *override_configfile, bool reload);
108
109 /**
110  * Ungrabs all keys, to be called before re-grabbing the keys because of a
111  * mapping_notify event or a configuration file reload
112  *
113  */
114 void ungrab_all_keys(xcb_connection_t *conn);
115
116 /**
117  * Grab the bound keys (tell X to send us keypress events for those keycodes)
118  *
119  */
120 void grab_all_keys(xcb_connection_t *conn);
121
122 /**
123  * Switches the key bindings to the given mode, if the mode exists
124  *
125  */
126 void switch_mode(xcb_connection_t *conn, const char *new_mode);
127
128 /* prototype for src/cfgparse.y */
129 void parse_file(const char *f);
130
131 #endif