Fixed ordering
This commit is contained in:
parent
93a38220e2
commit
0827583370
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -71,7 +71,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wlstreamer"
|
name = "wlstreamer"
|
||||||
version = "0.2.0"
|
version = "0.3.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde 1.0.117 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"serde_json 1.0.59 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
11
src/main.rs
11
src/main.rs
|
@ -1,4 +1,5 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::cmp::Ordering;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::io::{BufRead, BufReader, Error};
|
use std::io::{BufRead, BufReader, Error};
|
||||||
use std::process::{Child, Command, Stdio};
|
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();
|
return workspaces.into_iter().map(|w| w.output).collect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue