small amounts of work on ws monitor
This commit is contained in:
parent
bc6d1a94a5
commit
582b4cbe3f
3 changed files with 19 additions and 14 deletions
|
@ -46,6 +46,7 @@ fn main() -> Result<(), std::io::Error> {
|
|||
.values()
|
||||
.map(|it| it.clone())
|
||||
.collect::<Vec<Workspace>>();
|
||||
|
||||
workspaces.sort_by(|a, b| a.idx.cmp(&b.idx));
|
||||
workspaces.sort_by(|a, b| {
|
||||
a.output
|
||||
|
@ -71,13 +72,21 @@ fn main() -> Result<(), std::io::Error> {
|
|||
|
||||
let results = workspaces
|
||||
.iter()
|
||||
.map(|ws| WsData {
|
||||
color: output_colors_lut[&ws.output.clone().expect("unreachable")]
|
||||
[if ws.is_active { 1 } else { 0 }],
|
||||
idx: ws.idx,
|
||||
focused: ws.is_focused,
|
||||
active: ws.is_active,
|
||||
})
|
||||
.map(
|
||||
|Workspace {
|
||||
idx,
|
||||
output,
|
||||
is_active,
|
||||
is_focused,
|
||||
..
|
||||
}| WsData {
|
||||
color: output_colors_lut[&output.clone().expect("unreachable")]
|
||||
[if *is_active { 1 } else { 0 }],
|
||||
idx: *idx,
|
||||
focused: *is_focused,
|
||||
active: *is_active,
|
||||
},
|
||||
)
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
println!("{}", serde_json::to_string(&results).unwrap());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue