From b7c04bceff350deba78af7fb868161f8b859da97 Mon Sep 17 00:00:00 2001 From: crschnick Date: Tue, 17 Sep 2024 17:27:44 +0000 Subject: [PATCH] Update 11.4_incremental.md --- .../xpipe/app/browser/BrowserTransferModel.java | 3 ++- .../app/browser/file/BrowserFileListComp.java | 3 ++- .../io/xpipe/app/core/mode/OperationMode.java | 11 +++++++++++ .../io/xpipe/app/core/window/AppMainWindow.java | 11 +++++------ .../app/core/window/NativeMacOsWindowControl.java | 8 +------- .../io/xpipe/app/prefs/ExternalEditorType.java | 8 +++++++- .../xpipe/app/terminal/ExternalTerminalType.java | 10 +++++----- .../io/xpipe/app/util/DataStoreFormatter.java | 4 ++++ .../main/java/io/xpipe/app/util/LocalShell.java | 15 ++++++++++----- dist/changelogs/11.3_incremental.md | 1 + lang/app/strings/fixed_en.properties | 1 + 11 files changed, 49 insertions(+), 26 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/browser/BrowserTransferModel.java b/app/src/main/java/io/xpipe/app/browser/BrowserTransferModel.java index 5e5e0c24a..87e44d064 100644 --- a/app/src/main/java/io/xpipe/app/browser/BrowserTransferModel.java +++ b/app/src/main/java/io/xpipe/app/browser/BrowserTransferModel.java @@ -22,6 +22,7 @@ import org.apache.commons.io.FileUtils; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.StandardCopyOption; import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -169,7 +170,7 @@ public class BrowserTransferModel { if (Files.isDirectory(file)) { FileUtils.moveDirectory(file.toFile(), target.toFile()); } else { - FileUtils.moveFile(file.toFile(), target.toFile()); + FileUtils.moveFile(file.toFile(), target.toFile(), StandardCopyOption.REPLACE_EXISTING); } } DesktopHelper.browseFileInDirectory(downloads.resolve(files.getFirst().getFileName())); diff --git a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListComp.java b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListComp.java index 45b9ceae4..9eaba89c9 100644 --- a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListComp.java +++ b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListComp.java @@ -502,7 +502,8 @@ public final class BrowserFileListComp extends SimpleComp { updateHandler.run(); fileList.getShown().addListener((observable, oldValue, newValue) -> { - updateHandler.run(); + // Delay to prevent internal tableview exceptions when sorting + Platform.runLater(updateHandler); }); fileList.getFileSystemModel().getCurrentPath().addListener((observable, oldValue, newValue) -> { if (oldValue == null) { diff --git a/app/src/main/java/io/xpipe/app/core/mode/OperationMode.java b/app/src/main/java/io/xpipe/app/core/mode/OperationMode.java index ac3a76040..fd5b6c206 100644 --- a/app/src/main/java/io/xpipe/app/core/mode/OperationMode.java +++ b/app/src/main/java/io/xpipe/app/core/mode/OperationMode.java @@ -254,6 +254,17 @@ public abstract class OperationMode { Runtime.getRuntime().halt(code); } + public static void onWindowClose() { + if (AppPrefs.get() == null) { + return; + } + + var action = AppPrefs.get().closeBehaviour().getValue(); + ThreadHelper.runAsync(() -> { + action.run(); + }); + } + public static void shutdown(boolean inShutdownHook, boolean hasError) { // We can receive shutdown events while we are still starting up // In that case ignore them until we are finished diff --git a/app/src/main/java/io/xpipe/app/core/window/AppMainWindow.java b/app/src/main/java/io/xpipe/app/core/window/AppMainWindow.java index c493d0b04..d8d2f27ad 100644 --- a/app/src/main/java/io/xpipe/app/core/window/AppMainWindow.java +++ b/app/src/main/java/io/xpipe/app/core/window/AppMainWindow.java @@ -4,6 +4,7 @@ import io.xpipe.app.core.AppCache; import io.xpipe.app.resources.AppImages; import io.xpipe.app.core.AppProperties; import io.xpipe.app.core.AppTheme; +import io.xpipe.app.core.mode.OperationMode; import io.xpipe.app.fxcomps.Comp; import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.issue.TrackEvent; @@ -11,7 +12,6 @@ import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.prefs.CloseBehaviourAlert; import io.xpipe.app.util.ThreadHelper; import io.xpipe.core.process.OsType; - import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; import javafx.geometry.Rectangle2D; @@ -24,18 +24,17 @@ import javafx.scene.layout.Region; import javafx.scene.paint.Color; import javafx.stage.Screen; import javafx.stage.Stage; - import lombok.Builder; import lombok.Getter; import lombok.Value; import lombok.extern.jackson.Jacksonized; +import javax.imageio.ImageIO; import java.io.IOException; import java.nio.file.Path; import java.time.Duration; import java.time.Instant; import java.time.temporal.ChronoUnit; -import javax.imageio.ImageIO; public class AppMainWindow { @@ -167,14 +166,14 @@ public class AppMainWindow { // Close other windows Stage.getWindows().stream().filter(w -> !w.equals(stage)).toList().forEach(w -> w.fireEvent(e)); stage.close(); - AppPrefs.get().closeBehaviour().getValue().run(); + OperationMode.onWindowClose(); e.consume(); }); stage.addEventHandler(KeyEvent.KEY_PRESSED, event -> { if (new KeyCodeCombination(KeyCode.Q, KeyCombination.SHORTCUT_DOWN).match(event)) { stage.close(); - AppPrefs.get().closeBehaviour().getValue().run(); + OperationMode.onWindowClose(); event.consume(); } }); @@ -277,7 +276,7 @@ public class AppMainWindow { if (OsType.getLocal().equals(OsType.LINUX) || OsType.getLocal().equals(OsType.MACOS)) { stage.getScene().addEventHandler(KeyEvent.KEY_PRESSED, event -> { if (new KeyCodeCombination(KeyCode.W, KeyCombination.SHORTCUT_DOWN).match(event)) { - AppPrefs.get().closeBehaviour().getValue().run(); + OperationMode.onWindowClose(); event.consume(); } }); diff --git a/app/src/main/java/io/xpipe/app/core/window/NativeMacOsWindowControl.java b/app/src/main/java/io/xpipe/app/core/window/NativeMacOsWindowControl.java index f401c70c4..c15d14a10 100644 --- a/app/src/main/java/io/xpipe/app/core/window/NativeMacOsWindowControl.java +++ b/app/src/main/java/io/xpipe/app/core/window/NativeMacOsWindowControl.java @@ -1,14 +1,11 @@ package io.xpipe.app.core.window; +import com.sun.jna.NativeLong; import io.xpipe.app.core.AppProperties; import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.util.NativeBridge; -import io.xpipe.app.util.ThreadHelper; import io.xpipe.core.util.ModuleHelper; - import javafx.stage.Window; - -import com.sun.jna.NativeLong; import lombok.Getter; import lombok.SneakyThrows; @@ -45,9 +42,6 @@ public class NativeMacOsWindowControl { try { lib.get().setAppearance(new NativeLong(nsWindow), seamlessFrame, darkMode); - if (seamlessFrame) { - ThreadHelper.sleep(200); - } } catch (Throwable e) { ErrorEvent.fromThrowable(e).handle(); } diff --git a/app/src/main/java/io/xpipe/app/prefs/ExternalEditorType.java b/app/src/main/java/io/xpipe/app/prefs/ExternalEditorType.java index c5a3d5b74..24fa44ba8 100644 --- a/app/src/main/java/io/xpipe/app/prefs/ExternalEditorType.java +++ b/app/src/main/java/io/xpipe/app/prefs/ExternalEditorType.java @@ -76,7 +76,13 @@ public interface ExternalEditorType extends PrefsChoiceValue { } }; - LinuxPathType VSCODE_LINUX = new LinuxPathType("app.vscode", "code"); + LinuxPathType VSCODE_LINUX = new LinuxPathType("app.vscode", "code") { + @Override + public void launch(Path file) throws Exception { + var builder = CommandBuilder.of().fixedEnvrironment("DONT_PROMPT_WSL_INSTALL", "No_Prompt_please").addFile(executable).addFile(file.toString()); + ExternalApplicationHelper.startAsync(builder); + } + }; LinuxPathType ZED_LINUX = new LinuxPathType("app.zed", "zed"); diff --git a/app/src/main/java/io/xpipe/app/terminal/ExternalTerminalType.java b/app/src/main/java/io/xpipe/app/terminal/ExternalTerminalType.java index 6cf1ed66b..faf722313 100644 --- a/app/src/main/java/io/xpipe/app/terminal/ExternalTerminalType.java +++ b/app/src/main/java/io/xpipe/app/terminal/ExternalTerminalType.java @@ -1019,13 +1019,13 @@ public interface ExternalTerminalType extends PrefsChoiceValue { AlacrittyTerminalType.ALACRITTY_LINUX, WezTerminalType.WEZTERM_LINUX, KittyTerminalType.KITTY_LINUX, - KONSOLE, - XFCE, - ELEMENTARY, - GNOME_TERMINAL, - TILIX, TERMINATOR, TERMINOLOGY, + XFCE, + ELEMENTARY, + KONSOLE, + GNOME_TERMINAL, + TILIX, GUAKE, TILDA, XTERM, diff --git a/app/src/main/java/io/xpipe/app/util/DataStoreFormatter.java b/app/src/main/java/io/xpipe/app/util/DataStoreFormatter.java index 620cd5f15..cbf9d0103 100644 --- a/app/src/main/java/io/xpipe/app/util/DataStoreFormatter.java +++ b/app/src/main/java/io/xpipe/app/util/DataStoreFormatter.java @@ -61,6 +61,10 @@ public class DataStoreFormatter { return null; } + if (name.isEmpty()) { + return name; + } + return name.substring(0, 1).toUpperCase() + name.substring(1).toLowerCase(); } diff --git a/app/src/main/java/io/xpipe/app/util/LocalShell.java b/app/src/main/java/io/xpipe/app/util/LocalShell.java index bea8ff57c..93604db8f 100644 --- a/app/src/main/java/io/xpipe/app/util/LocalShell.java +++ b/app/src/main/java/io/xpipe/app/util/LocalShell.java @@ -1,6 +1,7 @@ package io.xpipe.app.util; import io.xpipe.app.ext.ProcessControlProvider; +import io.xpipe.core.process.ProcessOutputException; import io.xpipe.core.process.ShellControl; import io.xpipe.core.process.ShellDialects; @@ -38,11 +39,15 @@ public class LocalShell { } if (localPowershell == null) { - localPowershell = ProcessControlProvider.get() - .createLocalProcessControl(false) - .subShell(ShellDialects.POWERSHELL) - .withoutLicenseCheck() - .start(); + try { + localPowershell = ProcessControlProvider.get() + .createLocalProcessControl(false) + .subShell(ShellDialects.POWERSHELL) + .withoutLicenseCheck() + .start(); + } catch (ProcessOutputException ex) { + throw ProcessOutputException.withPrefix("Failed to start local powershell process", ex); + } } return localPowershell.start(); } diff --git a/dist/changelogs/11.3_incremental.md b/dist/changelogs/11.3_incremental.md index bf65a518f..e734f6fb0 100644 --- a/dist/changelogs/11.3_incremental.md +++ b/dist/changelogs/11.3_incremental.md @@ -10,6 +10,7 @@ - Fix application not starting up when PATH was corrupted on Windows - Fix shell environments running init script twice - Fix cmd shell environments not displaying a version +- Fix window close freezing for a short time - Fix proxmox pvesh issue ## News diff --git a/lang/app/strings/fixed_en.properties b/lang/app/strings/fixed_en.properties index 2871814f9..9278ae786 100644 --- a/lang/app/strings/fixed_en.properties +++ b/lang/app/strings/fixed_en.properties @@ -67,3 +67,4 @@ mobaXterm=MobaXterm termius=Termius devolutions=Devolutions tryPtb=XPipe Public Test Build +zed=Zed