diff --git a/Cargo.lock b/Cargo.lock index d9daebb3..8ff3ab2f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -394,7 +394,7 @@ dependencies = [ [[package]] name = "cosmic-panel-config" version = "0.1.0" -source = "git+https://github.com/pop-os/cosmic-panel/#8787823d807ea9a9d7b96ecacf017d695ba7b58a" +source = "git+https://github.com/pop-os/cosmic-panel#8787823d807ea9a9d7b96ecacf017d695ba7b58a" dependencies = [ "anyhow", "gtk4", diff --git a/applets/cosmic-applet-workspaces/src/main.rs b/applets/cosmic-applet-workspaces/src/main.rs index df6fa136..0eb046d0 100644 --- a/applets/cosmic-applet-workspaces/src/main.rs +++ b/applets/cosmic-applet-workspaces/src/main.rs @@ -8,9 +8,10 @@ use gtk4::{ CssProvider, StyleContext, }; use once_cell::sync::OnceCell; +use wayland::State; use std::sync::{Arc, Mutex}; use tokio::sync::mpsc; -use utils::{Activate, WorkspaceEvent}; +use utils::{Activate}; use window::CosmicWorkspacesWindow; mod localize; @@ -56,7 +57,7 @@ fn main() { app.connect_activate(|app| { load_css(); - let (tx, mut rx) = mpsc::channel::>(100); + let (tx, mut rx) = mpsc::channel::(100); let wayland_tx = wayland::spawn_workspaces(tx.clone()); let window = CosmicWorkspacesWindow::new(app); diff --git a/applets/cosmic-applet-workspaces/src/utils.rs b/applets/cosmic-applet-workspaces/src/utils.rs index e4639702..ac382e53 100644 --- a/applets/cosmic-applet-workspaces/src/utils.rs +++ b/applets/cosmic-applet-workspaces/src/utils.rs @@ -6,11 +6,6 @@ use gtk4::glib; use std::future::Future; pub type Activate = u32; -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct WorkspaceEvent { - pub(crate) id: u32, - pub(crate) active: bool, -} pub fn data_path() -> PathBuf { let mut path = glib::user_data_dir(); diff --git a/applets/cosmic-applet-workspaces/src/wayland.rs b/applets/cosmic-applet-workspaces/src/wayland.rs index d53c8941..b5f1849b 100644 --- a/applets/cosmic-applet-workspaces/src/wayland.rs +++ b/applets/cosmic-applet-workspaces/src/wayland.rs @@ -1,4 +1,4 @@ -use crate::utils::{Activate, WorkspaceEvent}; +use crate::utils::{Activate}; use std::{env, os::unix::net::UnixStream, path::PathBuf}; use tokio::sync::mpsc; use wayland_client::{ @@ -36,7 +36,7 @@ use self::generated::client::{ zext_workspace_handle_v1::{self, ZextWorkspaceHandleV1}, }; -pub fn spawn_workspaces(tx: mpsc::Sender>) -> mpsc::Sender { +pub fn spawn_workspaces(tx: mpsc::Sender) -> mpsc::Sender { let (workspaces_tx, mut workspaces_rx) = mpsc::channel(100); if let Ok(Ok(conn)) = std::env::var("HOST_WAYLAND_DISPLAY") .map_err(anyhow::Error::msg) @@ -76,19 +76,22 @@ pub fn spawn_workspaces(tx: mpsc::Sender>) -> mpsc::Sender>, + tx: mpsc::Sender, workspace_manager: Option, workspace_groups: Vec, } +#[derive(Debug, Clone)] struct WorkspaceGroup { workspace_group_handle: ZextWorkspaceGroupHandleV1, output: Option, workspaces: Vec, } +#[derive(Debug, Clone)] struct Workspace { workspace_handle: ZextWorkspaceHandleV1, name: String, @@ -151,7 +154,7 @@ impl Dispatch for State { zext_workspace_manager_v1::Event::Done => { // TODO println!("sending event with workspace list state"); - let _ = self.tx.send(Vec::new()); + let _ = self.tx.send(self.clone()); } zext_workspace_manager_v1::Event::Finished => { self.workspace_manager.take();