|
|
@ -40,8 +40,11 @@ where |
|
|
|
TS: std::fmt::Display + Sized, |
|
|
|
TS: std::fmt::Display + Sized, |
|
|
|
{ |
|
|
|
{ |
|
|
|
let mut map: std::collections::HashMap<String, &TS> = std::collections::HashMap::new(); |
|
|
|
let mut map: std::collections::HashMap<String, &TS> = std::collections::HashMap::new(); |
|
|
|
|
|
|
|
let mut strs: Vec<String> = vec![]; |
|
|
|
for c in choices { |
|
|
|
for c in choices { |
|
|
|
map.insert(format!("{}", c), c); |
|
|
|
let s = format!("{}", c); |
|
|
|
|
|
|
|
strs.push(String::from(s.as_str())); |
|
|
|
|
|
|
|
map.insert(s, c); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let mut wofi = proc::Command::new("wofi") |
|
|
|
let mut wofi = proc::Command::new("wofi") |
|
|
@ -58,11 +61,11 @@ where |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
let stdin = wofi.stdin.as_mut().expect("Failed to open wofi stdin"); |
|
|
|
let stdin = wofi.stdin.as_mut().expect("Failed to open wofi stdin"); |
|
|
|
for c in choices { |
|
|
|
let wofi_input = strs.join("\n"); |
|
|
|
stdin |
|
|
|
println!("Wofi input:\n{}", wofi_input); |
|
|
|
.write_all(format!("{}\n", c).as_bytes()) |
|
|
|
stdin |
|
|
|
.expect("Failed to write to wofi stdin"); |
|
|
|
.write_all(wofi_input.as_bytes()) |
|
|
|
} |
|
|
|
.expect("Failed to write to wofi stdin"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let output = wofi.wait_with_output().expect("Failed to read stdout"); |
|
|
|
let output = wofi.wait_with_output().expect("Failed to read stdout"); |
|
|
|