From 57f15da85d2d283ce26c8062c309808919278a24 Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Tue, 22 Nov 2022 16:31:58 +0100 Subject: [PATCH] ext_workspace: Fix activation for output-bound --- src/wayland/handlers/workspace.rs | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/wayland/handlers/workspace.rs b/src/wayland/handlers/workspace.rs index 26f7aca3..eecc24c6 100644 --- a/src/wayland/handlers/workspace.rs +++ b/src/wayland/handlers/workspace.rs @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only use crate::{ + shell::WorkspaceMode, state::ClientState, utils::prelude::*, wayland::protocols::workspace::{ @@ -29,14 +30,21 @@ impl WorkspaceHandler for State { for request in requests.into_iter() { match request { Request::Activate(handle) => { - let output = self.common.last_active_seat().active_output(); - let maybe_idx = self - .common - .shell - .workspaces - .spaces_for_output(&output) - .position(|w| w.handle == handle); - if let Some(idx) = maybe_idx { + let maybe = match &self.common.shell.workspaces { + WorkspaceMode::Global(set) => set + .workspaces + .iter() + .position(|w| w.handle == handle) + .map(|i| (self.common.last_active_seat().active_output(), i)), + WorkspaceMode::OutputBound(sets, _) => sets.iter().find_map(|(o, set)| { + set.workspaces + .iter() + .position(|w| w.handle == handle) + .map(|i| (o.clone(), i)) + }), + }; + + if let Some((output, idx)) = maybe { self.common.shell.activate(&output, idx); } }