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