Skip to content

Commit

Permalink
fix: correctly collect floating nodes
Browse files Browse the repository at this point in the history
My previous implementation broke at some point during the sway
updating. Never much liked the way I did it back then, change it to a
more function approach.
  • Loading branch information
roosta committed Jan 13, 2025
1 parent bbfbc71 commit 3332915
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,10 @@ pub fn get_workspaces(tree: Node) -> Vec<Node> {

/// Collect a vector of workspace titles
pub fn collect_titles(workspace: &Node, config: &Config, res: &regex::Compiled) -> Vec<String> {
let ws_nodes = {
let mut n = workspace.nodes.clone();
for fnode in &workspace.floating_nodes {
let mut f = fnode.nodes.clone();
n.append(&mut f);
}
n
};
let ws_nodes = workspace.nodes.iter()
.chain(workspace.floating_nodes.iter())
.cloned()
.collect::<Vec<Node>>();

let mut titles = Vec::new();
for node in &ws_nodes {
Expand Down

0 comments on commit 3332915

Please sign in to comment.