]> git.sur5r.net Git - i3/i3/blob - i3bar/include/common.h
Ensure all *.[ch] files include config.h
[i3/i3] / i3bar / include / common.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  */
8 #pragma once
9
10 #include <config.h>
11
12 #include <stdbool.h>
13 #include <xcb/xcb.h>
14 #include <xcb/xproto.h>
15 #include "libi3.h"
16 #include "queue.h"
17
18 typedef struct rect_t rect;
19
20 struct ev_loop *main_loop;
21
22 struct rect_t {
23     int x;
24     int y;
25     int w;
26     int h;
27 };
28
29 typedef enum {
30     /* First value to make it the default. */
31     ALIGN_LEFT,
32     ALIGN_CENTER,
33     ALIGN_RIGHT
34 } blockalign_t;
35
36 /* This data structure describes the way a status block should be rendered. These
37  * variables are updated each time the statusline is re-rendered. */
38 struct status_block_render_desc {
39     uint32_t width;
40     uint32_t x_offset;
41     uint32_t x_append;
42 };
43
44 /* This data structure represents one JSON dictionary, multiple of these make
45  * up one status line. */
46 struct status_block {
47     i3String *full_text;
48     i3String *short_text;
49
50     char *color;
51     char *background;
52     char *border;
53
54     /* min_width can be specified either as a numeric value (in pixels) or as a
55      * string. For strings, we set min_width to the measured text width of
56      * min_width_str. */
57     uint32_t min_width;
58     char *min_width_str;
59
60     blockalign_t align;
61
62     bool urgent;
63     bool no_separator;
64     bool pango_markup;
65
66     /* The amount of pixels necessary to render a separater after the block. */
67     uint32_t sep_block_width;
68
69     /* Continuously-updated information on how to render this status block. */
70     struct status_block_render_desc full_render;
71     struct status_block_render_desc short_render;
72
73     /* Optional */
74     char *name;
75     char *instance;
76
77     TAILQ_ENTRY(status_block) blocks;
78 };
79
80 TAILQ_HEAD(statusline_head, status_block) statusline_head;
81
82 #include "child.h"
83 #include "ipc.h"
84 #include "outputs.h"
85 #include "util.h"
86 #include "workspaces.h"
87 #include "mode.h"
88 #include "trayclients.h"
89 #include "xcb.h"
90 #include "configuration.h"
91 #include "libi3.h"
92 #include "parse_json_header.h"