]> git.sur5r.net Git - i3/i3/blob - i3bar/include/configuration.h
2a059046298e6fdd9f56958f0c0059fb9ae3057f
[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 "common.h"
13
14 typedef enum {
15     POS_NONE = 0,
16     POS_TOP,
17     POS_BOT
18 } position_t;
19
20 /* Bar display mode (hide unless modifier is pressed or show in dock mode or always hide in invisible mode) */
21 typedef enum { M_DOCK = 0,
22                M_HIDE = 1,
23                M_INVISIBLE = 2 } bar_display_mode_t;
24
25 typedef struct binding_t {
26     int input_code;
27     char *command;
28
29     TAILQ_ENTRY(binding_t) bindings;
30 } binding_t;
31
32 typedef struct tray_output_t {
33     char *output;
34
35     TAILQ_ENTRY(tray_output_t) tray_outputs;
36 } tray_output_t;
37
38 typedef struct config_t {
39     int modifier;
40     TAILQ_HEAD(bindings_head, binding_t) bindings;
41     position_t position;
42     int verbose;
43     struct xcb_color_strings_t colors;
44     bool disable_binding_mode_indicator;
45     bool disable_ws;
46     bool strip_ws_numbers;
47     char *bar_id;
48     char *command;
49     char *fontname;
50     i3String *separator_symbol;
51     TAILQ_HEAD(tray_outputs_head, tray_output_t) tray_outputs;
52     int tray_padding;
53     int num_outputs;
54     char **outputs;
55
56     bar_display_mode_t hide_on_modifier;
57
58     /* The current hidden_state of the bar, which indicates whether it is hidden or shown */
59     enum { S_HIDE = 0,
60            S_SHOW = 1 } hidden_state;
61 } config_t;
62
63 config_t config;
64
65 /**
66  * Start parsing the received bar configuration JSON string
67  *
68  */
69 void parse_config_json(char *json);
70
71 /**
72  * free()s the color strings as soon as they are not needed anymore.
73  *
74  */
75 void free_colors(struct xcb_color_strings_t *colors);