mirror of
https://github.com/swaywm/sway.git
synced 2025-11-24 06:59:51 -05:00
Set prev_workspace_name based off of focus
This moves setting `seat->prev_workspace_name` from `workspace_switch` to `set_workspace`. `workspace_switch` is only called when using a `workspace` command to change the workspace so any workspace change based on criteria was not altering `seat->prev_workspace_name`. By moving it to `set_workspace`, which is called by `seat_set_focus`, it will change any time focus changes to a node on a different workspace
This commit is contained in:
parent
d64e8ba946
commit
d8f74e4706
2 changed files with 12 additions and 12 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue