mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-05-19 13:58:37 -04:00
Small dock fixes [release]
This commit is contained in:
@@ -3,6 +3,7 @@ package io.xpipe.app.terminal;
|
||||
import io.xpipe.app.comp.base.ModalOverlay;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.core.AppLayoutModel;
|
||||
import io.xpipe.app.core.mode.AppOperationMode;
|
||||
import io.xpipe.app.core.window.AppDialog;
|
||||
import io.xpipe.app.core.window.AppMainWindow;
|
||||
import io.xpipe.app.platform.LabelGraphic;
|
||||
@@ -67,6 +68,14 @@ public class TerminalDockHubManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (AppOperationMode.get() != AppOperationMode.GUI) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (AppMainWindow.get() == null || !AppMainWindow.get().getStage().isShowing() || AppMainWindow.get().getStage().isIconified()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.app.util.GlobalTimer;
|
||||
import io.xpipe.app.util.Rect;
|
||||
|
||||
import io.xpipe.app.util.ThreadHelper;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.time.Duration;
|
||||
@@ -59,6 +60,7 @@ public class TerminalDockView {
|
||||
Math.abs(targetBounds.getW() - currentBounds.getW()) +
|
||||
Math.abs(targetBounds.getH() - currentBounds.getH());
|
||||
if (sum < 30) {
|
||||
ThreadHelper.sleep(300);
|
||||
trackTerminal(terminal, true);
|
||||
return;
|
||||
}
|
||||
@@ -71,16 +73,19 @@ public class TerminalDockView {
|
||||
}
|
||||
|
||||
public synchronized void trackTerminal(ControllableTerminalSession terminal, boolean dock) {
|
||||
if (viewActive && dock && viewBounds != null) {
|
||||
terminal.own();
|
||||
|
||||
if (viewActive && dock && viewBounds != null && NativeWinWindowControl.MAIN_WINDOW.isVisible() && !NativeWinWindowControl.MAIN_WINDOW.isIconified()) {
|
||||
// Bring main window to foreground since initial launch
|
||||
NativeWinWindowControl.MAIN_WINDOW.activate();
|
||||
|
||||
terminal.own();
|
||||
|
||||
// The window might be minimized
|
||||
// We always want to show the terminal though
|
||||
terminal.show();
|
||||
|
||||
// Move input focus to terminal
|
||||
terminal.focus();
|
||||
|
||||
terminal.updatePosition(windowBoundsFunction.apply(viewBounds));
|
||||
updateCustomBounds();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user