From 6cbce998923757a92bfa65a1e7ff33dfd2b77fdc Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Fri, 17 Sep 2021 08:56:23 +0200 Subject: [PATCH] Improve tab_current_workspace (less flicker) --- Cargo.lock | 4 ++-- src/cmds.rs | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3212f91..9324fcf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -436,9 +436,9 @@ checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" [[package]] name = "unicode-width" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" +checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" [[package]] name = "unicode-xid" diff --git a/src/cmds.rs b/src/cmds.rs index aafecc0..152ddff 100644 --- a/src/cmds.rs +++ b/src/cmds.rs @@ -351,7 +351,6 @@ fn tile_current_workspace(include_floating: bool, shuffle: bool) { } for win in wins { if win.is_floating() { - std::thread::sleep(std::time::Duration::from_millis(25)); con.run_command(format!( "[con_id={}] floating disable", win.get_id() @@ -391,16 +390,18 @@ fn tab_current_workspace(include_floating: bool) { let mut placed_wins = vec![]; wins.reverse(); for win in wins { + if win.is_floating() { + con.run_command(format!( + "[con_id={}] floating disable", + win.get_id() + ))?; + } + std::thread::sleep(std::time::Duration::from_millis(25)); con.run_command(format!( "[con_id={}] move to workspace current", win.get_id() ))?; - std::thread::sleep(std::time::Duration::from_millis(25)); - con.run_command(format!( - "[con_id={}] floating disable", - win.get_id() - ))?; placed_wins.push(win); } Ok(())