Fixed ordering

master 0.3.0
Benjamin Bädorf 2020-11-19 00:54:36 +01:00
parent 93a38220e2
commit 0827583370
No known key found for this signature in database
GPG Key ID: 4406E80E13CD656C
2 changed files with 11 additions and 2 deletions

2
Cargo.lock generated
View File

@ -71,7 +71,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "wlstreamer"
version = "0.2.0"
version = "0.3.0"
dependencies = [
"serde 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -1,4 +1,5 @@
use serde::{Deserialize, Serialize};
use std::cmp::Ordering;
use std::env;
use std::io::{BufRead, BufReader, Error};
use std::process::{Child, Command, Stdio};
@ -146,7 +147,15 @@ fn get_valid_screens_for_recording(config: &Config) -> Vec<String> {
}
}
workspaces.sort_by_key(|w| w.focused);
workspaces.sort_by(|a, b| {
if a.focused && !b.focused {
Ordering::Less
} else if a.focused == b.focused {
Ordering::Equal
} else {
Ordering::Greater
}
});
return workspaces.into_iter().map(|w| w.output).collect();
}