For unnamed niri workspaces use their niri workspace idx as workspace name

This mirrors the behavior of sway as sway ipc sets the sway workspace number
as name for unnamed sway workspaces
This commit is contained in:
Gergő Sályi 2025-04-08 21:04:16 +02:00
parent 75492df065
commit e64359806c

View file

@ -16,7 +16,7 @@ impl NiriConnectionTask {
{
if let Some(workspace) = workspaces.into_iter().find(|w| w.id == id) {
return (
workspace.name.unwrap_or_else(String::new),
workspace.name.unwrap_or_else(|| format!("{}", workspace.idx)),
workspace.output.unwrap_or_else(String::new),
);
}
@ -37,7 +37,8 @@ impl CompositorInterface for NiriConnectionTask {
.filter(|w| w.is_active)
.map(|workspace| WorkspaceVisible {
output: workspace.output.unwrap_or_default(),
workspace_name: workspace.name.unwrap_or_default(),
workspace_name: workspace.name
.unwrap_or_else(|| format!("{}", workspace.idx)),
})
.collect()
} else {