diff options
-rw-r--r-- | sway/commands/bar/position.c | 2 | ||||
-rw-r--r-- | sway/tree/output.c | 1 | ||||
-rw-r--r-- | sway/tree/workspace.c | 14 | ||||
-rw-r--r-- | swaybar/config.c | 8 |
4 files changed, 15 insertions, 10 deletions
diff --git a/sway/commands/bar/position.c b/sway/commands/bar/position.c index 44bb4ae3..2870f60f 100644 --- a/sway/commands/bar/position.c +++ b/sway/commands/bar/position.c | |||
@@ -12,7 +12,7 @@ struct cmd_results *bar_cmd_position(int argc, char **argv) { | |||
12 | if (!config->current_bar) { | 12 | if (!config->current_bar) { |
13 | return cmd_results_new(CMD_FAILURE, "position", "No bar defined."); | 13 | return cmd_results_new(CMD_FAILURE, "position", "No bar defined."); |
14 | } | 14 | } |
15 | char *valid[] = { "top", "bottom", "left", "right" }; | 15 | char *valid[] = { "top", "bottom" }; |
16 | for (size_t i = 0; i < sizeof(valid) / sizeof(valid[0]); ++i) { | 16 | for (size_t i = 0; i < sizeof(valid) / sizeof(valid[0]); ++i) { |
17 | if (strcasecmp(valid[i], argv[0]) == 0) { | 17 | if (strcasecmp(valid[i], argv[0]) == 0) { |
18 | wlr_log(WLR_DEBUG, "Setting bar position '%s' for bar: %s", | 18 | wlr_log(WLR_DEBUG, "Setting bar position '%s' for bar: %s", |
diff --git a/sway/tree/output.c b/sway/tree/output.c index 524a64ab..04219b5f 100644 --- a/sway/tree/output.c +++ b/sway/tree/output.c | |||
@@ -89,6 +89,7 @@ void output_enable(struct sway_output *output, struct output_config *oc) { | |||
89 | } | 89 | } |
90 | } | 90 | } |
91 | free(ws_name); | 91 | free(ws_name); |
92 | ipc_event_workspace(NULL, ws, "init"); | ||
92 | } | 93 | } |
93 | 94 | ||
94 | size_t len = sizeof(output->layers) / sizeof(output->layers[0]); | 95 | size_t len = sizeof(output->layers) / sizeof(output->layers[0]); |
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index e840219f..fff16515 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c | |||
@@ -119,6 +119,11 @@ void workspace_begin_destroy(struct sway_workspace *workspace) { | |||
119 | 119 | ||
120 | if (workspace->output) { | 120 | if (workspace->output) { |
121 | workspace_detach(workspace); | 121 | workspace_detach(workspace); |
122 | } else { | ||
123 | int index = list_find(root->saved_workspaces, workspace); | ||
124 | if (index != -1) { | ||
125 | list_del(root->saved_workspaces, index); | ||
126 | } | ||
122 | } | 127 | } |
123 | 128 | ||
124 | workspace->node.destroying = true; | 129 | workspace->node.destroying = true; |
@@ -126,10 +131,13 @@ void workspace_begin_destroy(struct sway_workspace *workspace) { | |||
126 | } | 131 | } |
127 | 132 | ||
128 | void workspace_consider_destroy(struct sway_workspace *ws) { | 133 | void workspace_consider_destroy(struct sway_workspace *ws) { |
129 | if (ws->tiling->length == 0 && ws->floating->length == 0 | 134 | if (ws->tiling->length || ws->floating->length) { |
130 | && output_get_active_workspace(ws->output) != ws) { | 135 | return; |
131 | workspace_begin_destroy(ws); | 136 | } |
137 | if (ws->output && output_get_active_workspace(ws->output) == ws) { | ||
138 | return; | ||
132 | } | 139 | } |
140 | workspace_begin_destroy(ws); | ||
133 | } | 141 | } |
134 | 142 | ||
135 | char *prev_workspace_name = NULL; | 143 | char *prev_workspace_name = NULL; |
diff --git a/swaybar/config.c b/swaybar/config.c index eafb0b69..1293cdae 100644 --- a/swaybar/config.c +++ b/swaybar/config.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #define _XOPEN_SOURCE 500 | 1 | #define _XOPEN_SOURCE 500 |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | #include <string.h> | 3 | #include <string.h> |
4 | #include <wlr/util/log.h> | ||
4 | #include "swaybar/config.h" | 5 | #include "swaybar/config.h" |
5 | #include "wlr-layer-shell-unstable-v1-client-protocol.h" | 6 | #include "wlr-layer-shell-unstable-v1-client-protocol.h" |
6 | #include "stringop.h" | 7 | #include "stringop.h" |
@@ -9,17 +10,12 @@ | |||
9 | uint32_t parse_position(const char *position) { | 10 | uint32_t parse_position(const char *position) { |
10 | uint32_t horiz = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | | 11 | uint32_t horiz = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | |
11 | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT; | 12 | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT; |
12 | uint32_t vert = ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | | ||
13 | ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM; | ||
14 | if (strcmp("top", position) == 0) { | 13 | if (strcmp("top", position) == 0) { |
15 | return ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | horiz; | 14 | return ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | horiz; |
16 | } else if (strcmp("bottom", position) == 0) { | 15 | } else if (strcmp("bottom", position) == 0) { |
17 | return ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | horiz; | 16 | return ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | horiz; |
18 | } else if (strcmp("left", position) == 0) { | ||
19 | return ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | vert; | ||
20 | } else if (strcmp("right", position) == 0) { | ||
21 | return ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT | vert; | ||
22 | } else { | 17 | } else { |
18 | wlr_log(WLR_ERROR, "Invalid position: %s, defaulting to bottom", position); | ||
23 | return ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | horiz; | 19 | return ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | horiz; |
24 | } | 20 | } |
25 | } | 21 | } |