From 6b409dfe183d62c09a34d207863747a8690b7673 Mon Sep 17 00:00:00 2001 From: Alex Janka Date: Tue, 1 Oct 2024 10:20:46 +1000 Subject: [PATCH] don't reorganise if workspace has open vscode --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- src/main.rs | 12 ++++++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7664dc9..e324dfb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -1041,7 +1041,7 @@ dependencies = [ [[package]] name = "sway-flash-indicator" -version = "0.6.4" +version = "0.6.5" dependencies = [ "directories", "futures-util", diff --git a/Cargo.toml b/Cargo.toml index a98123b..b8369a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sway-flash-indicator" -version = "0.6.4" +version = "0.6.5" edition = "2021" [dependencies] diff --git a/src/main.rs b/src/main.rs index 0200c16..009b094 100644 --- a/src/main.rs +++ b/src/main.rs @@ -221,6 +221,18 @@ async fn code_trigger + std::cmp::PartialEq>( return Ok(()); } + if workspace + .find_as_ref(|n| { + n.app_id + .as_ref() + .is_some_and(|app_id| app_id.starts_with("code") && n.id != id) + }) + .is_some() + { + // don't reorganise if this workspace already has a vscode window + return Ok(()); + } + while workspace.focus.len() == 1 { workspace = get_with_id(workspace, workspace.focus[0])?; }