aboutsummaryrefslogtreecommitdiff
path: root/sway/workspace.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/workspace.c')
-rw-r--r--sway/workspace.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sway/workspace.c b/sway/workspace.c
index bc0fa2c8..ed545804 100644
--- a/sway/workspace.c
+++ b/sway/workspace.c
@@ -174,6 +174,17 @@ void workspace_prev() {
}
void workspace_switch(swayc_t *workspace) {
+ if (!workspace) {
+ return;
+ }
+ sway_log(L_DEBUG, "Switching to workspace %p:%s", workspace, workspace->name);
+
+ // Remove focus from current view
+ swayc_t *current = get_focused_view(&root_container);
+ if (current && current->type == C_VIEW) {
+ wlc_view_set_state(current->handle, WLC_BIT_ACTIVATED, false);
+ }
+
set_focused_container(workspace);
active_workspace = workspace;
}