aboutsummaryrefslogtreecommitdiff
path: root/sway/input
diff options
context:
space:
mode:
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/seat.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c
index be523539..e56a6510 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -763,6 +763,18 @@ static void set_workspace(struct sway_seat *seat,
if (seat->workspace == new_ws) {
return;
}
+
+ if (seat->workspace) {
+ free(seat->prev_workspace_name);
+ seat->prev_workspace_name = malloc(strlen(seat->workspace->name) + 1);
+ if (!seat->prev_workspace_name) {
+ sway_log(SWAY_ERROR, "Unable to allocate previous workspace name");
+ seat->prev_workspace_name = NULL;
+ } else {
+ strcpy(seat->prev_workspace_name, seat->workspace->name);
+ }
+ }
+
ipc_event_workspace(seat->workspace, new_ws, "focus");
seat->workspace = new_ws;
}