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]]
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",

View file

@ -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::<IcedWorkspacesApplet>(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(