]> git.sur5r.net Git - i3/i3/blob - i3bar/include/configuration.h
Merge branch 'next' into master
[i3/i3] / i3bar / include / configuration.h
1 /*
2  * vim:ts=4:sw=4:expandtab
3  *
4  * i3bar - an xcb-based status- and ws-bar for i3
5  * © 2010 Axel Wagner and contributors (see also: LICENSE)
6  *
7  * config.c: Parses the configuration (received from i3).
8  *
9  */
10 #pragma once
11
12 #include <config.h>
13
14 #include "common.h"
15
16 typedef enum {
17     POS_NONE = 0,
18     POS_TOP,
19     POS_BOT
20 } position_t;
21
22 /* Bar display mode (hide unless modifier is pressed or show in dock mode or always hide in invisible mode) */
23 typedef enum { M_DOCK = 0,
24                M_HIDE = 1,
25                M_INVISIBLE = 2 } bar_display_mode_t;
26
27 typedef struct binding_t {
28     int input_code;
29     char *command;
30
31     TAILQ_ENTRY(binding_t)
32     bindings;
33 } binding_t;
34
35 typedef struct tray_output_t {
36     char *output;
37
38     TAILQ_ENTRY(tray_output_t)
39     tray_outputs;
40 } tray_output_t;
41
42 typedef struct config_t {
43     int modifier;
44
45     TAILQ_HEAD(bindings_head, binding_t)
46     bindings;
47
48     position_t position;
49     int verbose;
50     struct xcb_color_strings_t colors;
51     bool disable_binding_mode_indicator;
52     bool disable_ws;
53     bool strip_ws_numbers;
54     char *bar_id;
55     char *command;
56     char *fontname;
57     i3String *separator_symbol;
58
59     TAILQ_HEAD(tray_outputs_head, tray_output_t)
60     tray_outputs;
61
62     int tray_padding;
63     int num_outputs;
64     char **outputs;
65
66     bar_display_mode_t hide_on_modifier;
67
68     /* The current hidden_state of the bar, which indicates whether it is hidden or shown */
69     enum { S_HIDE = 0,
70            S_SHOW = 1 } hidden_state;
71 } config_t;
72
73 config_t config;
74
75 /**
76  * Start parsing the received bar configuration JSON string
77  *
78  */
79 void parse_config_json(char *json);
80
81 /**
82  * free()s the color strings as soon as they are not needed anymore.
83  *
84  */
85 void free_colors(struct xcb_color_strings_t *colors);