]> git.sur5r.net Git - i3/i3/blob - i3bar/include/configuration.h
61cac7f6bdcab344de7cbaaa9dfc5f1a8c4fc1f3
[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     bool release;
31
32     TAILQ_ENTRY(binding_t)
33     bindings;
34 } binding_t;
35
36 typedef struct tray_output_t {
37     char *output;
38
39     TAILQ_ENTRY(tray_output_t)
40     tray_outputs;
41 } tray_output_t;
42
43 typedef struct config_t {
44     int modifier;
45
46     TAILQ_HEAD(bindings_head, binding_t)
47     bindings;
48
49     position_t position;
50     int verbose;
51     struct xcb_color_strings_t colors;
52     bool disable_binding_mode_indicator;
53     bool disable_ws;
54     bool strip_ws_numbers;
55     char *bar_id;
56     char *command;
57     char *fontname;
58     i3String *separator_symbol;
59
60     TAILQ_HEAD(tray_outputs_head, tray_output_t)
61     tray_outputs;
62
63     int tray_padding;
64     int num_outputs;
65     char **outputs;
66
67     bar_display_mode_t hide_on_modifier;
68
69     /* The current hidden_state of the bar, which indicates whether it is hidden or shown */
70     enum { S_HIDE = 0,
71            S_SHOW = 1 } hidden_state;
72 } config_t;
73
74 config_t config;
75
76 /**
77  * Start parsing the received bar configuration JSON string
78  *
79  */
80 void parse_config_json(char *json);
81
82 /**
83  * free()s the color strings as soon as they are not needed anymore.
84  *
85  */
86 void free_colors(struct xcb_color_strings_t *colors);