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