diff options
Diffstat (limited to 'swaybar/state.c')
-rw-r--r-- | swaybar/state.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/swaybar/state.c b/swaybar/state.c new file mode 100644 index 00000000..900842e0 --- /dev/null +++ b/swaybar/state.c | |||
@@ -0,0 +1,29 @@ | |||
1 | #include <stdlib.h> | ||
2 | |||
3 | #include "list.h" | ||
4 | #include "config.h" | ||
5 | #include "status_line.h" | ||
6 | #include "state.h" | ||
7 | |||
8 | struct swaybar_state *init_state() { | ||
9 | struct swaybar_state *state = calloc(1, sizeof(struct swaybar_state)); | ||
10 | state->config = init_config(); | ||
11 | state->status = init_status_line(); | ||
12 | state->output = malloc(sizeof(struct output)); | ||
13 | state->output->window = NULL; | ||
14 | state->output->registry = NULL; | ||
15 | state->output->workspaces = create_list(); | ||
16 | |||
17 | return state; | ||
18 | } | ||
19 | |||
20 | void free_workspace(void *item) { | ||
21 | if (!item) { | ||
22 | return; | ||
23 | } | ||
24 | struct workspace *ws = (struct workspace *)item; | ||
25 | if (ws->name) { | ||
26 | free(ws->name); | ||
27 | } | ||
28 | free(ws); | ||
29 | } | ||