mirror of
https://github.com/labwc/labwc.git
synced 2025-11-03 09:01:51 -05:00
config: support <desktops number="">
This commit is contained in:
parent
e82e557d56
commit
9bb4f44688
2 changed files with 17 additions and 4 deletions
|
|
@ -8,6 +8,7 @@
|
|||
#include <libxml/tree.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <unistd.h>
|
||||
|
|
@ -24,6 +25,7 @@
|
|||
#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"
|
||||
|
|
@ -613,6 +615,8 @@ entry(xmlNode *node, char *nodename, char *content)
|
|||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -755,6 +759,7 @@ rcxml_init(void)
|
|||
rc.window_switcher.outlines = true;
|
||||
|
||||
rc.workspace_config.popuptime = INT_MIN;
|
||||
rc.workspace_config.count = 1;
|
||||
}
|
||||
|
||||
static struct {
|
||||
|
|
@ -1042,10 +1047,17 @@ post_processing(void)
|
|||
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue