1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-08-16 22:31:03 +02:00

fix(workspaces): niri workspaces not respecting added sort (#911)

* refactor: sort niri workspaces before init

* chore: comment for ordered_niri_workspace changing
This commit is contained in:
MapoMagpie 2025-03-24 22:16:23 +08:00 committed by GitHub
parent 66bdac52d6
commit 3320cf27b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -40,7 +40,11 @@ impl Client {
let mut updates: Vec<WorkspaceUpdate> = vec![];
if first_event {
updates.push(WorkspaceUpdate::Init(new_workspaces.clone()));
// Niri's WorkspacesChanged event does not initially sort workspaces by ID when first output,
// which makes sort = added meaningless. Therefore, new_workspaces are sorted by ID here to ensure a consistent addition order.
let mut new_workspaces = new_workspaces.clone();
new_workspaces.sort_by_key(|w| w.id);
updates.push(WorkspaceUpdate::Init(new_workspaces));
first_event = false;
} else {
// first pass - add/update