aboutsummaryrefslogtreecommitdiff
path: root/swaybar/state.c
diff options
context:
space:
mode:
authorMikkel Oscar Lyderik <mikkeloscar@gmail.com>2016-01-23 20:55:01 +0100
committerMikkel Oscar Lyderik <mikkeloscar@gmail.com>2016-01-24 14:22:19 +0100
commita6349a2444571624c792ca222dff57c7f1711c71 (patch)
tree486e5df9eff701f75ce05d80a3e16c397ad596dc /swaybar/state.c
parentbb986cb33637147663c115c8b8f8bdff170f23a8 (diff)
downloadsway-a6349a2444571624c792ca222dff57c7f1711c71.tar.xz
swaybar: feactor render, statusline
Diffstat (limited to 'swaybar/state.c')
-rw-r--r--swaybar/state.c29
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 @@
+#include <stdlib.h>
+
+#include "list.h"
+#include "config.h"
+#include "status_line.h"
+#include "state.h"
+
+struct swaybar_state *init_state() {
+ struct swaybar_state *state = calloc(1, sizeof(struct swaybar_state));
+ state->config = init_config();
+ state->status = init_status_line();
+ state->output = malloc(sizeof(struct output));
+ state->output->window = NULL;
+ state->output->registry = NULL;
+ state->output->workspaces = create_list();
+
+ return state;
+}
+
+void free_workspace(void *item) {
+ if (!item) {
+ return;
+ }
+ struct workspace *ws = (struct workspace *)item;
+ if (ws->name) {
+ free(ws->name);
+ }
+ free(ws);
+}