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