From 4af2d4d669e58e1aa48e094223637de2d0f1eea9 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Fri, 30 Dec 2022 15:35:36 -0800 Subject: [PATCH] WIP activate workspace --- src/main.rs | 22 +++++++++++++++++----- src/wayland.rs | 5 +---- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/main.rs b/src/main.rs index f921a98..76692c9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -52,9 +52,9 @@ struct Toplevel { struct LayerSurface { output: wl_output::WlOutput, output_name: Option, - // Active workspace - // windows in workspace - // - for transitions, would need windows in more than one workspace + active_workspace: Option, + // for transitions, would need windows in more than one workspace? But don't capture all of + // them all the time every frame. } #[derive(Default)] @@ -99,6 +99,7 @@ impl Application for App { LayerSurface { output: output.clone(), output_name: info.name, + active_workspace: None, }, ); return get_layer_surface(SctkLayerSurfaceSettings { @@ -172,8 +173,19 @@ impl Application for App { std::process::exit(0); } Msg::Closed(_) => {} - Msg::ActivateWorkspace(workspace) => { - // TODO + Msg::ActivateWorkspace(workspace_handle) => { + // XXX + for workspace in &self.workspaces { + if &workspace.handle == &workspace_handle { + for surface in self.layer_surfaces.values_mut() { + if &surface.output_name == &workspace.output_name { + surface.active_workspace = Some(workspace_handle); + break; + } + } + break; + } + } } } diff --git a/src/wayland.rs b/src/wayland.rs index b5a06df..447f7fd 100644 --- a/src/wayland.rs +++ b/src/wayland.rs @@ -150,10 +150,7 @@ impl ToplevelInfoHandler for AppData { toplevel: &zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1, ) { let info = self.toplevel_info_state.info(&toplevel).unwrap(); - self.send_event(Event::NewToplevel( - toplevel.clone(), - info.clone(), - )); + self.send_event(Event::NewToplevel(toplevel.clone(), info.clone())); let frame = self.screencopy_state.screencopy_manager.capture_toplevel( toplevel,