Keep workspace presentation in numeric order

This commit is contained in:
Samuel Onoja committed 2026-09-29 21:29:58 +01:00
1 parent b2363a18b0
commit ae712b6b40
7 files changed
+59 -29

No files matched your search

+5 -14
View File
@@ -602,20 +602,11 @@ impl Ferese {
let Some(current) = self.output_workspaces.active_workspace(output) else {
return;
};
let mut candidates = self
.workspaces
.iter()
.filter(|workspace| {
self.output_workspaces
.output_for_workspace(workspace.id)
.is_none_or(|owner| owner == output)
})
.collect::<Vec<_>>();
candidates.sort_by_key(|workspace| {
(
workspace.name.parse::<u32>().unwrap_or(u32::MAX),
workspace.id.0,
)
let mut candidates = self.workspaces.ordered();
candidates.retain(|workspace| {
self.output_workspaces
.output_for_workspace(workspace.id)
.is_none_or(|owner| owner == output)
});
let Some(index) = candidates
.iter()
+3 -3
View File
@@ -507,9 +507,10 @@ impl Ferese {
fn workspaces_json(&self) -> Value {
let active = self.workspaces.active_id();
let mut workspaces = self
let workspaces = self
.workspaces
.iter()
.ordered()
.into_iter()
.map(|workspace| {
let mode = match workspace.layout.mode() {
LayoutMode::Scrolling => "scrolling",
@@ -525,7 +526,6 @@ impl Ferese {
})
})
.collect::<Vec<_>>();
workspaces.sort_by_key(|workspace| workspace["id"].as_u64());
Value::Array(workspaces)
}
+2 -4
View File
@@ -650,8 +650,7 @@ impl Ferese {
let selected = self.output_workspaces.active_workspace(output_id);
let strip = workspace_strip(bounds);
let capacity = strip_capacity(strip);
let mut workspaces = self.workspaces.iter().collect::<Vec<_>>();
workspaces.sort_by_key(|workspace| workspace.name.parse::<u64>().unwrap_or(workspace.id.0));
let workspaces = self.workspaces.ordered();
let selected_index = workspaces
.iter()
.position(|workspace| Some(workspace.id) == selected)
@@ -770,8 +769,7 @@ impl Ferese {
};
let capacity = strip_capacity(workspace_strip(bounds));
let cards = self.overview_workspace_cards(&output);
let mut ordered = self.workspaces.iter().collect::<Vec<_>>();
ordered.sort_by_key(|workspace| workspace.name.parse::<u64>().unwrap_or(workspace.id.0));
let ordered = self.workspaces.ordered();
let current = cards
.first()
.and_then(|card| {
+4 -7
View File
@@ -215,9 +215,9 @@ impl Ferese {
}
fn workspace_snapshots(&self) -> Vec<WorkspaceSnapshot> {
let mut workspaces = self
.workspaces
.iter()
self.workspaces
.ordered()
.into_iter()
.map(|workspace| {
let output = self.output_workspaces.output_for_workspace(workspace.id);
let active = output.is_some_and(|output| {
@@ -231,10 +231,7 @@ impl Ferese {
active,
}
})
.collect::<Vec<_>>();
workspaces.sort_by_key(|workspace| workspace.id.0);
workspaces
.collect()
}
fn managed_window_snapshots(&self) -> Vec<ManagedWindowSnapshot> {