summaryrefslogtreecommitdiffstats
path: root/include/config.h
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2015-11-08 12:06:12 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2015-11-08 12:06:51 -0500
commitedb3e4b5ab50b283a64a8099e5b2b26a9f3071b1 (patch)
treea8e94d77e39b24f2fa480bb1f2f22c0ef8994ab6 /include/config.h
parentMerge pull request #217 from mikkeloscar/ipc-h (diff)
downloadsway-edb3e4b5ab50b283a64a8099e5b2b26a9f3071b1.tar.gz
sway-edb3e4b5ab50b283a64a8099e5b2b26a9f3071b1.tar.zst
sway-edb3e4b5ab50b283a64a8099e5b2b26a9f3071b1.zip
Add some documentation comments
This is mostly setting a precedent, I hope that others will continue to write docs for more headers. Ref #218
Diffstat (limited to 'include/config.h')
-rw-r--r--include/config.h36
1 files changed, 35 insertions, 1 deletions
diff --git a/include/config.h b/include/config.h
index 636d3ec0..8338033c 100644
--- a/include/config.h
+++ b/include/config.h
@@ -8,22 +8,36 @@
8#include "layout.h" 8#include "layout.h"
9#include "container.h" 9#include "container.h"
10 10
11/**
12 * Describes a variable created via the `set` command.
13 */
11struct sway_variable { 14struct sway_variable {
12 char *name; 15 char *name;
13 char *value; 16 char *value;
14}; 17};
15 18
19/**
20 * A key binding and an associated command.
21 */
16struct sway_binding { 22struct sway_binding {
17 list_t *keys; 23 list_t *keys;
18 uint32_t modifiers; 24 uint32_t modifiers;
19 char *command; 25 char *command;
20}; 26};
21 27
28/**
29 * A "mode" of keybindings created via the `mode` command.
30 */
22struct sway_mode { 31struct sway_mode {
23 char *name; 32 char *name;
24 list_t *bindings; 33 list_t *bindings;
25}; 34};
26 35
36/**
37 * Size and position configuration for a particular output.
38 *
39 * This is set via the `output` command.
40 */
27struct output_config { 41struct output_config {
28 char *name; 42 char *name;
29 bool enabled; 43 bool enabled;
@@ -31,11 +45,19 @@ struct output_config {
31 int x, y; 45 int x, y;
32}; 46};
33 47
48/**
49 * Maps a workspace name to an output name.
50 *
51 * Set via `workspace <x> output <y>`
52 */
34struct workspace_output { 53struct workspace_output {
35 char *output; 54 char *output;
36 char *workspace; 55 char *workspace;
37}; 56};
38 57
58/**
59 * The configuration struct. The result of loading a config file.
60 */
39struct sway_config { 61struct sway_config {
40 list_t *symbols; 62 list_t *symbols;
41 list_t *modes; 63 list_t *modes;
@@ -62,12 +84,24 @@ struct sway_config {
62 int gaps_outer; 84 int gaps_outer;
63}; 85};
64 86
87/**
88 * Loads the config from the given path.
89 */
65bool load_config(const char *file); 90bool load_config(const char *file);
91/** Reads the config from the given FILE.
92 */
66bool read_config(FILE *file, bool is_active); 93bool read_config(FILE *file, bool is_active);
94/**
95 * Does variable replacement for a string based on the config's currently loaded variables.
96 */
67char *do_var_replacement(char *str); 97char *do_var_replacement(char *str);
68// Setup output container by applying given config 98/** Sets up a WLC output handle based on a given output_config.
99 */
69void apply_output_config(struct output_config *oc, swayc_t *output); 100void apply_output_config(struct output_config *oc, swayc_t *output);
70 101
102/**
103 * Global config singleton.
104 */
71extern struct sway_config *config; 105extern struct sway_config *config;
72 106
73#endif 107#endif