don't reorganise if workspace has open vscode

This commit is contained in:
Alex Janka 2024-10-01 10:20:46 +10:00
parent efd2dd8f34
commit 6b409dfe18
3 changed files with 15 additions and 3 deletions

4
Cargo.lock generated
View file

@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo. # This file is automatically @generated by Cargo.
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 version = 4
[[package]] [[package]]
name = "addr2line" name = "addr2line"
@ -1041,7 +1041,7 @@ dependencies = [
[[package]] [[package]]
name = "sway-flash-indicator" name = "sway-flash-indicator"
version = "0.6.4" version = "0.6.5"
dependencies = [ dependencies = [
"directories", "directories",
"futures-util", "futures-util",

View file

@ -1,6 +1,6 @@
[package] [package]
name = "sway-flash-indicator" name = "sway-flash-indicator"
version = "0.6.4" version = "0.6.5"
edition = "2021" edition = "2021"
[dependencies] [dependencies]

View file

@ -221,6 +221,18 @@ async fn code_trigger<T: AsRef<str> + std::cmp::PartialEq<str>>(
return Ok(()); 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 { while workspace.focus.len() == 1 {
workspace = get_with_id(workspace, workspace.focus[0])?; workspace = get_with_id(workspace, workspace.focus[0])?;
} }