aboutsummaryrefslogtreecommitdiff
path: root/src/workspace.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/workspace.c')
-rw-r--r--src/workspace.c39
1 files changed, 3 insertions, 36 deletions
diff --git a/src/workspace.c b/src/workspace.c
index 9d8fd8bd..1bf1225c 100644
--- a/src/workspace.c
+++ b/src/workspace.c
@@ -135,38 +135,11 @@ Con *workspace_get(const char *num) {
}
LOG("Creating new workspace \"%s\"\n", num);
- gaps_t gaps = (gaps_t){0, 0, 0, 0, 0};
/* We set workspace->num to the number if this workspace’s name begins with
* a positive number. Otherwise it’s a named ws and num will be 1. */
const int parsed_num = ws_name_to_number(num);
- struct Workspace_Assignment *assignment;
- TAILQ_FOREACH (assignment, &ws_assignments, ws_assignments) {
- if (strcmp(assignment->name, num) == 0) {
- gaps = assignment->gaps;
- break;
- } else if (parsed_num != -1 && name_is_digits(assignment->name) && ws_name_to_number(assignment->name) == parsed_num) {
- gaps = assignment->gaps;
- }
- }
-
- if (gaps.inner != 0) {
- gaps.inner -= config.gaps.inner;
- }
- if (gaps.top != 0) {
- gaps.top -= config.gaps.top;
- }
- if (gaps.right != 0) {
- gaps.right -= config.gaps.right;
- }
- if (gaps.bottom != 0) {
- gaps.bottom -= config.gaps.bottom;
- }
- if (gaps.left != 0) {
- gaps.left -= config.gaps.left;
- }
-
Con *output = get_assigned_output(num, parsed_num);
/* if an assignment is not found, we create this workspace on the current output */
if (!output) {
@@ -187,7 +160,7 @@ Con *workspace_get(const char *num) {
workspace->workspace_layout = config.default_layout;
workspace->num = parsed_num;
workspace->type = CT_WORKSPACE;
- workspace->gaps = gaps;
+ workspace->gaps = gaps_for_workspace(workspace);
con_attach(workspace, output_get_content(output), false);
_workspace_apply_default_orientation(workspace);
@@ -314,14 +287,6 @@ Con *create_workspace_on_output(Output *output, Con *content) {
sasprintf(&(ws->name), "%d", c);
}
- struct Workspace_Assignment *assignment;
- TAILQ_FOREACH (assignment, &ws_assignments, ws_assignments) {
- if (strcmp(assignment->name, ws->name) == 0) {
- ws->gaps = assignment->gaps;
- break;
- }
- }
-
con_attach(ws, content, false);
char *name;
@@ -329,6 +294,8 @@ Con *create_workspace_on_output(Output *output, Con *content) {
x_set_name(ws, name);
free(name);
+ ws->gaps = gaps_for_workspace(ws);
+
ws->fullscreen_mode = CF_OUTPUT;
ws->workspace_layout = config.default_layout;