diff options
Diffstat (limited to 'sway/workspace.c')
-rw-r--r-- | sway/workspace.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sway/workspace.c b/sway/workspace.c index 0f36e35a..866276d8 100644 --- a/sway/workspace.c +++ b/sway/workspace.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include "focus.h" | 13 | #include "focus.h" |
14 | #include "util.h" | 14 | #include "util.h" |
15 | 15 | ||
16 | char *prev_workspace_name; | 16 | char *prev_workspace_name = ""; |
17 | 17 | ||
18 | char *workspace_next_name(void) { | 18 | char *workspace_next_name(void) { |
19 | sway_log(L_DEBUG, "Workspace: Generating new name"); | 19 | sway_log(L_DEBUG, "Workspace: Generating new name"); |
@@ -182,7 +182,11 @@ void workspace_switch(swayc_t *workspace) { | |||
182 | if (!workspace) { | 182 | if (!workspace) { |
183 | return; | 183 | return; |
184 | } | 184 | } |
185 | if (!prev_workspace_name || strcmp(prev_workspace_name, swayc_active_workspace()->name) != 0) { | 185 | if (strcmp(prev_workspace_name, swayc_active_workspace()->name) != 0 && swayc_active_workspace() != workspace) { |
186 | prev_workspace_name = malloc(strlen(swayc_active_workspace()->name) + 1); | ||
187 | strcpy(prev_workspace_name, swayc_active_workspace()->name); | ||
188 | } else if (config->auto_back_and_forth && swayc_active_workspace() == workspace && strlen(prev_workspace_name) != 0) { | ||
189 | workspace = workspace_by_name(prev_workspace_name) ? workspace_by_name(prev_workspace_name) : workspace_create(prev_workspace_name); | ||
186 | prev_workspace_name = malloc(strlen(swayc_active_workspace()->name) + 1); | 190 | prev_workspace_name = malloc(strlen(swayc_active_workspace()->name) + 1); |
187 | strcpy(prev_workspace_name, swayc_active_workspace()->name); | 191 | strcpy(prev_workspace_name, swayc_active_workspace()->name); |
188 | } | 192 | } |