mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
workspaces: Implement config parsing
This commit is contained in:
parent
d557623c34
commit
ae2fa1571b
3 changed files with 63 additions and 0 deletions
|
|
@ -21,6 +21,7 @@
|
|||
#include "config/libinput.h"
|
||||
#include "config/mousebind.h"
|
||||
#include "config/rcxml.h"
|
||||
#include "workspaces.h"
|
||||
|
||||
static bool in_keybind;
|
||||
static bool in_mousebind;
|
||||
|
|
@ -387,6 +388,12 @@ entry(xmlNode *node, char *nodename, char *content)
|
|||
rc.snap_top_maximize = get_bool(content);
|
||||
} else if (!strcasecmp(nodename, "cycleViewPreview.core")) {
|
||||
rc.cycle_preview_contents = get_bool(content);
|
||||
} else if (!strcasecmp(nodename, "name.names.desktops")) {
|
||||
struct workspace *workspace = calloc(1, sizeof(struct workspace));
|
||||
workspace->name = strdup(content);
|
||||
wl_list_insert(rc.workspace_config.workspaces.prev, &workspace->link);
|
||||
} else if (!strcasecmp(nodename, "popupTime.desktops")) {
|
||||
rc.workspace_config.popuptime = atoi(content);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -486,6 +493,8 @@ rcxml_init()
|
|||
rc.snap_edge_range = 1;
|
||||
rc.snap_top_maximize = true;
|
||||
rc.cycle_preview_contents = false;
|
||||
rc.workspace_config.popuptime = INT_MIN;
|
||||
wl_list_init(&rc.workspace_config.workspaces);
|
||||
}
|
||||
|
||||
static struct {
|
||||
|
|
@ -620,6 +629,14 @@ post_processing(void)
|
|||
struct libinput_category *l = libinput_category_create();
|
||||
l->type = TOUCH_DEVICE;
|
||||
}
|
||||
if (!wl_list_length(&rc.workspace_config.workspaces)) {
|
||||
struct workspace *workspace = calloc(1, sizeof(struct workspace));
|
||||
workspace->name = strdup("Default");
|
||||
wl_list_insert(rc.workspace_config.workspaces.prev, &workspace->link);
|
||||
}
|
||||
if (rc.workspace_config.popuptime == INT_MIN) {
|
||||
rc.workspace_config.popuptime = 1000;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -718,6 +735,13 @@ rcxml_finish(void)
|
|||
zfree(l);
|
||||
}
|
||||
|
||||
struct workspace *w, *w_tmp;
|
||||
wl_list_for_each_safe(w, w_tmp, &rc.workspace_config.workspaces, link) {
|
||||
wl_list_remove(&w->link);
|
||||
zfree(w->name);
|
||||
zfree(w);
|
||||
}
|
||||
|
||||
/* Reset state vars for starting fresh when Reload is triggered */
|
||||
current_keybind = NULL;
|
||||
current_mousebind = NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue