aboutsummaryrefslogtreecommitdiffstats
path: root/include/swaybar/bar.h
blob: 010e1f84cd6e9f4ed3180c9fec24f336a25ed776 (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
68
69
70
71
#ifndef _SWAYBAR_BAR_H
#define _SWAYBAR_BAR_H

#include "client/registry.h"
#include "client/window.h"
#include "list.h"

struct bar {
	struct config *config;
	struct status_line *status;
	list_t *outputs;
	struct output *focused_output;

	int ipc_event_socketfd;
	int ipc_socketfd;
	int status_read_fd;
	pid_t status_command_pid;
};

struct output {
	struct window *window;
	struct registry *registry;
	list_t *workspaces;
#ifdef ENABLE_TRAY
	list_t *items;
#endif
	char *name;
	int idx;
	bool focused;
};

struct workspace {
	int num;
	char *name;
	bool focused;
	bool visible;
	bool urgent;
};

/** Global bar state */
extern struct bar swaybar;

/** True if sway needs to render */
extern bool dirty;

/**
 * Setup bar.
 */
void bar_setup(struct bar *bar, const char *socket_path, const char *bar_id);

/**
 * Create new output struct from name.
 */
struct output *new_output(const char *name);

/**
 * Bar mainloop.
 */
void bar_run(struct bar *bar);

/**
 * free workspace list.
 */
void free_workspaces(list_t *workspaces);

/**
 * Teardown bar.
 */
void bar_teardown(struct bar *bar);

#endif /* _SWAYBAR_BAR_H */