From 15b1d6e6e0c277dd22932844573b0fda00bb1944 Mon Sep 17 00:00:00 2001 From: quietvoid Date: Mon, 2 Dec 2024 17:28:42 -0500 Subject: [PATCH] sway: support workspace rename events And reorder based on label with fallback to widget name --- src/clients/compositor/sway.rs | 10 ++++++++++ src/modules/workspaces.rs | 14 +++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/clients/compositor/sway.rs b/src/clients/compositor/sway.rs index 7cc61b74..e7091a12 100644 --- a/src/clients/compositor/sway.rs +++ b/src/clients/compositor/sway.rs @@ -109,6 +109,16 @@ impl From for WorkspaceUpdate { WorkspaceChange::Move => { Self::Move(event.current.expect("Missing current workspace").into()) } + WorkspaceChange::Rename => { + if let Some(node) = event.current { + Self::Rename { + id: node.id, + name: node.name.unwrap_or_default(), + } + } else { + Self::Unknown + } + } WorkspaceChange::Urgent => { if let Some(node) = event.current { Self::Urgent { diff --git a/src/modules/workspaces.rs b/src/modules/workspaces.rs index c9fbc77d..039d969e 100644 --- a/src/modules/workspaces.rs +++ b/src/modules/workspaces.rs @@ -164,7 +164,15 @@ fn reorder_workspaces(container: >k::Box) { let mut buttons = container .children() .into_iter() - .map(|child| (child.widget_name().to_string(), child)) + .map(|child| { + let label = child + .downcast_ref::