From 4e88ed2ffffcd69c4a47cdc0d9dee31e9c88f123 Mon Sep 17 00:00:00 2001 From: crschnick Date: Tue, 26 Nov 2024 16:46:26 +0000 Subject: [PATCH] [release] --- .../file/BrowserFileSystemTabModel.java | 3 +++ .../xpipe/app/terminal/TerminalDockComp.java | 26 +++++++++---------- .../app/terminal/WindowsTerminalType.java | 5 ++-- dist/changelogs/13.3.2_incremental.md | 2 ++ 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileSystemTabModel.java b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileSystemTabModel.java index e85de5731..a68e4b891 100644 --- a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileSystemTabModel.java +++ b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileSystemTabModel.java @@ -232,6 +232,9 @@ private boolean shouldLaunchSplitTerminal() { // Check if the right side is already occupied var existingSplit = f.getEffectiveRightTab().getValue(); + if (existingSplit == this) { + return false; + } if (existingSplit != null && !(existingSplit instanceof BrowserTerminalDockTabModel)) { return false; } diff --git a/app/src/main/java/io/xpipe/app/terminal/TerminalDockComp.java b/app/src/main/java/io/xpipe/app/terminal/TerminalDockComp.java index ba9a12071..01d130c94 100644 --- a/app/src/main/java/io/xpipe/app/terminal/TerminalDockComp.java +++ b/app/src/main/java/io/xpipe/app/terminal/TerminalDockComp.java @@ -52,11 +52,6 @@ public void changed(ObservableValue observable, Number oldValu update(stack); } }; - s.xProperty().addListener(update); - s.yProperty().addListener(update); - s.widthProperty().addListener(update); - s.heightProperty().addListener(update); - var iconified = new ChangeListener() { @Override public void changed(ObservableValue observable, Boolean oldValue, Boolean newValue) { @@ -67,8 +62,6 @@ public void changed(ObservableValue observable, Boolean oldVa } } }; - s.iconifiedProperty().addListener(iconified); - var focus = new ChangeListener() { @Override public void changed(ObservableValue observable, Boolean oldValue, Boolean newValue) { @@ -79,26 +72,21 @@ public void changed(ObservableValue observable, Boolean oldVa } } }; - s.focusedProperty().addListener(focus); - var show = new EventHandler() { @Override public void handle(WindowEvent event) { update(stack); } }; - s.addEventFilter(WindowEvent.WINDOW_SHOWN, show); - var hide = new EventHandler() { @Override public void handle(WindowEvent event) { update(stack); } }; - s.addEventFilter(WindowEvent.WINDOW_HIDING, hide); - stack.sceneProperty().addListener((observable, oldValue, newValue) -> { - if (oldValue != null && newValue == null) { + stack.sceneProperty().subscribe(scene -> { + if (scene == null) { s.xProperty().removeListener(update); s.yProperty().removeListener(update); s.widthProperty().removeListener(update); @@ -107,6 +95,16 @@ public void handle(WindowEvent event) { s.focusedProperty().removeListener(focus); s.removeEventFilter(WindowEvent.WINDOW_SHOWN, show); s.removeEventFilter(WindowEvent.WINDOW_HIDING, hide); + } else { + s.xProperty().addListener(update); + s.yProperty().addListener(update); + s.widthProperty().addListener(update); + s.heightProperty().addListener(update); + s.iconifiedProperty().addListener(iconified); + s.focusedProperty().addListener(focus); + s.addEventFilter(WindowEvent.WINDOW_SHOWN, show); + s.addEventFilter(WindowEvent.WINDOW_HIDING, hide); + update(stack); } }); } diff --git a/app/src/main/java/io/xpipe/app/terminal/WindowsTerminalType.java b/app/src/main/java/io/xpipe/app/terminal/WindowsTerminalType.java index 063b982ec..7536928f3 100644 --- a/app/src/main/java/io/xpipe/app/terminal/WindowsTerminalType.java +++ b/app/src/main/java/io/xpipe/app/terminal/WindowsTerminalType.java @@ -22,9 +22,8 @@ public interface WindowsTerminalType extends ExternalTerminalType, TrackableTerm static AtomicInteger windowCounter = new AtomicInteger(2); private static CommandBuilder toCommand(TerminalLaunchConfiguration configuration) throws Exception { - var cmd = CommandBuilder.of().addIf(configuration.isPreferTabs(), "-w", "1") - .addIf(!configuration.isPreferTabs(),"-w", "" + windowCounter.getAndIncrement()) - .add("nt"); + var cmd = CommandBuilder.of().addIf(configuration.isPreferTabs(), "-w", "1", "nt") + .addIf(!configuration.isPreferTabs(),"-w", "" + windowCounter.getAndIncrement()); if (configuration.getColor() != null) { cmd.add("--tabColor").addQuoted(configuration.getColor().toHexString()); diff --git a/dist/changelogs/13.3.2_incremental.md b/dist/changelogs/13.3.2_incremental.md index 096e74ee0..a911a5434 100644 --- a/dist/changelogs/13.3.2_incremental.md +++ b/dist/changelogs/13.3.2_incremental.md @@ -1 +1,3 @@ - Fix Windows Terminal docking not working probably if new instance behavior had been set to attach in the Windows Terminal settings +- Fix terminal dock not moving terminals anymore after tab switch +- Fix terminal still trying to dock when launched from a pinned tab