From 9f7c3918c4a0388b0d957718a7b1be011d99cdea Mon Sep 17 00:00:00 2001 From: quietvoid Date: Thu, 5 Dec 2024 07:04:22 -0500 Subject: [PATCH] feat(sway): support workspace rename events (#799) 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::