1
0
Fork 0
forked from wry/wry

output: use natural sort for workspace ordering

Fixes: https://github.com/mahkoh/jay/issues/843
This commit is contained in:
llyyr 2026-03-30 19:55:29 +05:30
parent 24293a53e7
commit a71e97ce4e
5 changed files with 13 additions and 4 deletions

View file

@ -69,6 +69,7 @@ use {
},
ahash::AHashMap,
jay_config::video::{TearingMode as ConfigTearingMode, VrrMode as ConfigVrrMode},
numeric_sort::cmp,
smallvec::SmallVec,
std::{
cell::{Cell, RefCell},
@ -730,7 +731,7 @@ impl OutputNode {
pub fn find_workspace_insertion_point(&self, name: &str) -> Option<NodeRef<Rc<WorkspaceNode>>> {
if self.state.workspace_display_order.get() == WorkspaceDisplayOrder::Sorted {
for existing_ws in self.workspaces.iter() {
if name < existing_ws.name.as_str() {
if cmp(name, &existing_ws.name) == std::cmp::Ordering::Less {
return Some(existing_ws);
}
}
@ -1133,7 +1134,7 @@ impl OutputNode {
pub fn handle_workspace_display_order_update(self: &Rc<Self>) {
if self.state.workspace_display_order.get() == WorkspaceDisplayOrder::Sorted {
let mut workspaces: Vec<_> = self.workspaces.iter().collect();
workspaces.sort_by(|a, b| a.name.cmp(&b.name));
workspaces.sort_by(|a, b| cmp(&a.name, &b.name));
for ws_ref in workspaces {
ws_ref.detach();
self.workspaces.add_last_existing(&ws_ref);