Compare commits
2 commits
663f30fc15
...
975aef0b0c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
975aef0b0c | ||
|
|
09bff58900 |
1 changed files with 4 additions and 9 deletions
|
|
@ -36,19 +36,17 @@ fn get_app_icon(window: Node) -> PathBuf {
|
|||
|
||||
fn node_finder(mut node: Node) -> Option<Vec<Node>> {
|
||||
let mut node_list = Vec::<Node>::new();
|
||||
debug!("{:?}, {:?}", node.name, node.scratchpad_state);
|
||||
if node.scratchpad_state.eq(&Some(ScratchpadState::Fresh)) {
|
||||
node_list.push(node);
|
||||
} else {
|
||||
node.nodes.append(&mut node.floating_nodes);
|
||||
for node in node.nodes {
|
||||
if let Some(mut nodes) = node_finder(node) {
|
||||
debug!("appending {:?} to {:?}", nodes, node_list);
|
||||
|
||||
node_list.append(&mut nodes);
|
||||
}
|
||||
}
|
||||
};
|
||||
debug!("{:?}", node_list);
|
||||
if !node_list.is_empty() {
|
||||
Some(node_list)
|
||||
} else {
|
||||
|
|
@ -77,17 +75,14 @@ pub fn get_scratchpad_info() -> Value {
|
|||
let tree = get_sway_connection().get_tree().expect("todo");
|
||||
let scratch_start = Instant::now();
|
||||
|
||||
let scratchpad_nodes: Vec<Node> = tree
|
||||
let mut scratchpad_windows: Vec<ScratchpadInfo> = tree
|
||||
.nodes
|
||||
.iter()
|
||||
.filter_map(|x| node_finder(x.clone()))
|
||||
.flatten()
|
||||
.map(|node| scratchpad_strip(node))
|
||||
.collect();
|
||||
let mut scratchpad_windows: Vec<ScratchpadInfo> = scratchpad_nodes
|
||||
.iter()
|
||||
.map(|node| scratchpad_strip(node.clone()))
|
||||
.collect();
|
||||
scratchpad_windows.sort_by(|x,y|x.window_id.cmp(&y.window_id));
|
||||
scratchpad_windows.sort_by(|x, y| x.window_id.cmp(&y.window_id));
|
||||
debug!(
|
||||
"parsed scratchpad window info in {:?}",
|
||||
scratch_start.elapsed()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue