From a4b0d2de4e6ff049a6214549785b8e19ea116c03 Mon Sep 17 00:00:00 2001 From: Ryan Brue Date: Tue, 9 Apr 2024 15:33:03 -0500 Subject: [PATCH] workspaces: click active workspace to open overview --- Cargo.lock | 10 +++++----- cosmic-applet-workspaces/src/components/app.rs | 11 ++++++++++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index de7e0e26..6a0930ba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2129,9 +2129,9 @@ dependencies = [ [[package]] name = "freedesktop-desktop-entry" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "287f89b1a3d88dd04d2b65dfec39f3c381efbcded7b736456039c4ee49d54b17" +checksum = "c201444ddafb5506fe85265b48421664ff4617e3b7090ef99e42a0070c1aead0" dependencies = [ "dirs 3.0.2", "gettext-rs", @@ -5843,7 +5843,7 @@ dependencies = [ "js-sys", "log", "naga", - "parking_lot 0.11.2", + "parking_lot 0.12.1", "profiling", "raw-window-handle 0.6.0", "smallvec", @@ -5870,7 +5870,7 @@ dependencies = [ "log", "naga", "once_cell", - "parking_lot 0.11.2", + "parking_lot 0.12.1", "profiling", "raw-window-handle 0.6.0", "rustc-hash", @@ -5910,7 +5910,7 @@ dependencies = [ "naga", "objc", "once_cell", - "parking_lot 0.11.2", + "parking_lot 0.12.1", "profiling", "range-alloc", "raw-window-handle 0.6.0", diff --git a/cosmic-applet-workspaces/src/components/app.rs b/cosmic-applet-workspaces/src/components/app.rs index 094809d0..1464a8f0 100644 --- a/cosmic-applet-workspaces/src/components/app.rs +++ b/cosmic-applet-workspaces/src/components/app.rs @@ -17,6 +17,8 @@ use crate::config; use crate::wayland::{WorkspaceEvent, WorkspaceList}; use crate::wayland_subscription::{workspaces, WorkspacesUpdate}; +use std::process::Command as ShellCommand; + pub fn run() -> cosmic::iced::Result { cosmic::applet::run::(true, ()) } @@ -39,6 +41,7 @@ enum Message { WorkspaceUpdate(WorkspacesUpdate), WorkspacePressed(ObjectId), WheelScrolled(ScrollDelta), + WorkspaceOverview, } impl cosmic::Application for IcedWorkspacesApplet { @@ -114,6 +117,9 @@ impl cosmic::Application for IcedWorkspacesApplet { let _ = tx.try_send(WorkspaceEvent::Scroll(delta)); } } + Message::WorkspaceOverview => { + let _ = ShellCommand::new("cosmic-workspaces").spawn(); + } } Command::none() } @@ -157,7 +163,10 @@ impl cosmic::Application for IcedWorkspacesApplet { } else { [self.core.applet.suggested_padding(), 0] }) - .on_press(Message::WorkspacePressed(w.2.clone())) + .on_press(match w.1 { + Some(zcosmic_workspace_handle_v1::State::Active) => Message::WorkspaceOverview, + _ => Message::WorkspacePressed(w.2.clone()), + }) .padding(0); Some(