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