Minor changes

timeout_old
Tassilo Horn 4 years ago
parent a3e77587ff
commit 03e190067b
  1. 5
      src/client.rs
  2. 15
      src/util.rs
  3. 4
      src/window.rs

@ -15,8 +15,9 @@ fn get_window_props() -> Result<HashMap<ipc::Id, ipc::WindowProps>, serde_json::
pub fn switch_window() {
let root_node = get_tree();
let mut windows = window::get_windows(&root_node);
if let Ok(win_props) = get_window_props() {
window::sort_windows(&mut windows, win_props);
match get_window_props() {
Ok(win_props) => window::sort_windows(&mut windows, win_props),
Err(e) => eprintln!("Got no win_props: {:?}", e),
}
if let Some(window) = util::select_window(&windows) {

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

@ -65,9 +65,9 @@ pub fn sort_windows(windows: &mut Vec<Window>, win_props: HashMap<ipc::Id, ipc::
std::cmp::Ordering::Less
} else if !a.node.urgent && b.node.urgent {
std::cmp::Ordering::Greater
} else if a.node.focused {
} else if a.node.focused && !b.node.focused {
std::cmp::Ordering::Greater
} else if b.node.focused {
} else if !a.node.focused && b.node.focused {
std::cmp::Ordering::Less
} else {
let lru_a = win_props

Loading…
Cancel
Save