]> git.sur5r.net Git - i3/i3/blob - include/config.h
Implement options to change the default mode of containers
[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         /** The modifier which needs to be pressed in combination with your mouse
80          * buttons to do things with floating windows (move, resize) */
81         uint32_t floating_modifier;
82
83         /* Color codes are stored here */
84         struct config_client {
85                 struct Colortriple focused;
86                 struct Colortriple focused_inactive;
87                 struct Colortriple unfocused;
88                 struct Colortriple urgent;
89         } client;
90         struct config_bar {
91                 struct Colortriple focused;
92                 struct Colortriple unfocused;
93                 struct Colortriple urgent;
94         } bar;
95 };
96
97 /**
98  * Reads the configuration from ~/.i3/config or /etc/i3/config if not found.
99  *
100  * If you specify override_configpath, only this path is used to look for a
101  * configuration file.
102  *
103  */
104 void load_configuration(xcb_connection_t *conn, const char *override_configfile, bool reload);
105
106 /**
107  * Ungrabs all keys, to be called before re-grabbing the keys because of a
108  * mapping_notify event or a configuration file reload
109  *
110  */
111 void ungrab_all_keys(xcb_connection_t *conn);
112
113 /**
114  * Grab the bound keys (tell X to send us keypress events for those keycodes)
115  *
116  */
117 void grab_all_keys(xcb_connection_t *conn);
118
119 /**
120  * Switches the key bindings to the given mode, if the mode exists
121  *
122  */
123 void switch_mode(xcb_connection_t *conn, const char *new_mode);
124
125 #endif