fix: consistent ordering of workspaces

This commit is contained in:
Ashley Wulber 2022-09-08 11:24:02 -04:00
parent 10a0312f4f
commit 0ecba6a6d0
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
3 changed files with 6 additions and 1 deletions

1
Cargo.lock generated
View file

@ -500,6 +500,7 @@ dependencies = [
"gtk4",
"i18n-embed",
"i18n-embed-fl",
"itertools",
"libadwaita",
"libcosmic",
"log",

View file

@ -24,6 +24,7 @@ wayland-client = { version = "0.30.0-beta.8" }
calloop = "*"
nix = "*"
log = "0.4"
itertools = "0.10"
[build-dependencies]
gio = "0.15.10"

View file

@ -13,6 +13,7 @@ use gtk4::Inhibit;
use gtk4::ListView;
use gtk4::SignalListItemFactory;
use gtk4::{gio, glib, prelude::*, subclass::prelude::*};
use itertools::Itertools;
mod imp;
@ -75,7 +76,9 @@ impl WorkspaceList {
let model_len = model.n_items();
let new_results: Vec<glib::Object> = workspaces
.workspace_list()
.into_iter()
.sorted_by(|a, b| {
a.0.cmp(&b.0)
})
.filter_map(|w| {
// don't include hidden workspaces
if w.1 != 2 {