workspaces: click active workspace to open overview

This commit is contained in:
Ryan Brue 2024-04-09 15:33:03 -05:00 committed by Jeremy Soller
parent 216d88e977
commit a4b0d2de4e
2 changed files with 15 additions and 6 deletions

10
Cargo.lock generated
View file

@ -2129,9 +2129,9 @@ dependencies = [
[[package]] [[package]]
name = "freedesktop-desktop-entry" name = "freedesktop-desktop-entry"
version = "0.5.1" version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "287f89b1a3d88dd04d2b65dfec39f3c381efbcded7b736456039c4ee49d54b17" checksum = "c201444ddafb5506fe85265b48421664ff4617e3b7090ef99e42a0070c1aead0"
dependencies = [ dependencies = [
"dirs 3.0.2", "dirs 3.0.2",
"gettext-rs", "gettext-rs",
@ -5843,7 +5843,7 @@ dependencies = [
"js-sys", "js-sys",
"log", "log",
"naga", "naga",
"parking_lot 0.11.2", "parking_lot 0.12.1",
"profiling", "profiling",
"raw-window-handle 0.6.0", "raw-window-handle 0.6.0",
"smallvec", "smallvec",
@ -5870,7 +5870,7 @@ dependencies = [
"log", "log",
"naga", "naga",
"once_cell", "once_cell",
"parking_lot 0.11.2", "parking_lot 0.12.1",
"profiling", "profiling",
"raw-window-handle 0.6.0", "raw-window-handle 0.6.0",
"rustc-hash", "rustc-hash",
@ -5910,7 +5910,7 @@ dependencies = [
"naga", "naga",
"objc", "objc",
"once_cell", "once_cell",
"parking_lot 0.11.2", "parking_lot 0.12.1",
"profiling", "profiling",
"range-alloc", "range-alloc",
"raw-window-handle 0.6.0", "raw-window-handle 0.6.0",

View file

@ -17,6 +17,8 @@ use crate::config;
use crate::wayland::{WorkspaceEvent, WorkspaceList}; use crate::wayland::{WorkspaceEvent, WorkspaceList};
use crate::wayland_subscription::{workspaces, WorkspacesUpdate}; use crate::wayland_subscription::{workspaces, WorkspacesUpdate};
use std::process::Command as ShellCommand;
pub fn run() -> cosmic::iced::Result { pub fn run() -> cosmic::iced::Result {
cosmic::applet::run::<IcedWorkspacesApplet>(true, ()) cosmic::applet::run::<IcedWorkspacesApplet>(true, ())
} }
@ -39,6 +41,7 @@ enum Message {
WorkspaceUpdate(WorkspacesUpdate), WorkspaceUpdate(WorkspacesUpdate),
WorkspacePressed(ObjectId), WorkspacePressed(ObjectId),
WheelScrolled(ScrollDelta), WheelScrolled(ScrollDelta),
WorkspaceOverview,
} }
impl cosmic::Application for IcedWorkspacesApplet { impl cosmic::Application for IcedWorkspacesApplet {
@ -114,6 +117,9 @@ impl cosmic::Application for IcedWorkspacesApplet {
let _ = tx.try_send(WorkspaceEvent::Scroll(delta)); let _ = tx.try_send(WorkspaceEvent::Scroll(delta));
} }
} }
Message::WorkspaceOverview => {
let _ = ShellCommand::new("cosmic-workspaces").spawn();
}
} }
Command::none() Command::none()
} }
@ -157,7 +163,10 @@ impl cosmic::Application for IcedWorkspacesApplet {
} else { } else {
[self.core.applet.suggested_padding(), 0] [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); .padding(0);
Some( Some(