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