#include <libxml/tree.h>
#include <stdbool.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include "config/libinput.h"
#include "config/mousebind.h"
#include "config/rcxml.h"
+#include "labwc.h"
#include "regions.h"
#include "window-rules.h"
#include "workspaces.h"
wl_list_append(&rc.workspace_config.workspaces, &workspace->link);
} else if (!strcasecmp(nodename, "popupTime.desktops")) {
rc.workspace_config.popuptime = atoi(content);
+ } else if (!strcasecmp(nodename, "number.desktops")) {
+ rc.workspace_config.count = MAX(1, atoi(content));
}
}
rc.window_switcher.outlines = true;
rc.workspace_config.popuptime = INT_MIN;
+ rc.workspace_config.count = 1;
}
static struct {
struct libinput_category *l = libinput_category_create();
assert(l && libinput_category_get_default() == l);
}
- if (!wl_list_length(&rc.workspace_config.workspaces)) {
- struct workspace *workspace = znew(*workspace);
- workspace->name = xstrdup("Default");
- wl_list_append(&rc.workspace_config.workspaces, &workspace->link);
+
+ int workspaces_configured = wl_list_length(&rc.workspace_config.workspaces);
+ if (workspaces_configured < rc.workspace_config.count) {
+ struct workspace *workspace;
+ char workspace_name[32]; // Maximum length of workspace name "Workspace X"
+ for (int i = workspaces_configured; i < rc.workspace_config.count; i++) {
+ workspace = znew(*workspace);
+ snprintf(workspace_name, sizeof(workspace_name), "Workspace %d", i + 1);
+ workspace->name = xstrdup(workspace_name);
+ wl_list_append(&rc.workspace_config.workspaces, &workspace->link);
+ }
}
if (rc.workspace_config.popuptime == INT_MIN) {
rc.workspace_config.popuptime = 1000;