aboutsummaryrefslogtreecommitdiffstats
path: root/include/swaybar/status_line.h
blob: 3ec0fcd08b570994898dfa409c036320605dc7d9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef _SWAYBAR_STATUS_LINE_H
#define _SWAYBAR_STATUS_LINE_H

#include <stdint.h>
#include <stdbool.h>

#include "list.h"
#include "bar.h"

typedef enum {UNDEF, TEXT, I3BAR} command_protocol;

struct status_line {
	list_t *block_line;
	const char *text_line;
	command_protocol protocol;
	bool click_events;
};

struct status_block {
	char *full_text, *short_text, *align;
	bool urgent;
	uint32_t color;
	int min_width;
	char *name, *instance;
	bool separator;
	int separator_block_width;
	bool markup;
	// Airblader features
	uint32_t background;
	uint32_t border;
	int border_top;
	int border_bottom;
	int border_left;
	int border_right;

	// Set during rendering
	int x;
	int width;
};

/**
 * Initialize status line struct.
 */
struct status_line *init_status_line();

/**
 * handle status line activity.
 */
bool handle_status_line(struct bar *bar);

/**
 * This should be called if statusline input cannot be accessed.
 * It will set an error statusline instead of using the status command
 */
void handle_status_hup(struct status_line *status);

/**
 * Handle mouse clicks.
 */
bool status_line_mouse_event(struct bar *bar, int x, int y, uint32_t button);

/**
 * Free status line struct.
 */
void free_status_line(struct status_line *line);

#endif /* _SWAYBAR_STATUS_LINE_H */