From bcd715e35a53fd1bdd669a2e8d74198478a09266 Mon Sep 17 00:00:00 2001 From: crschnick Date: Sat, 31 Jan 2026 20:40:17 +0000 Subject: [PATCH] Various fixes --- .../app/hub/comp/StoreChoicePopover.java | 9 ++++++++ .../xpipe/app/process/ElevationFunction.java | 23 +++++++++++++++++++ .../io/xpipe/app/storage/DataStorage.java | 2 +- .../src/main/java/io/xpipe/core/FilePath.java | 2 +- .../ext/system/incus/IncusCommandView.java | 4 ++-- .../xpipe/ext/system/lxd/LxdCommandView.java | 4 ++-- 6 files changed, 38 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/hub/comp/StoreChoicePopover.java b/app/src/main/java/io/xpipe/app/hub/comp/StoreChoicePopover.java index 760c109c5..4b620795a 100644 --- a/app/src/main/java/io/xpipe/app/hub/comp/StoreChoicePopover.java +++ b/app/src/main/java/io/xpipe/app/hub/comp/StoreChoicePopover.java @@ -22,6 +22,8 @@ import javafx.beans.property.SimpleStringProperty; import javafx.collections.ListChangeListener; import javafx.geometry.Insets; import javafx.scene.Node; +import javafx.scene.input.KeyCode; +import javafx.scene.input.KeyEvent; import javafx.scene.layout.Region; import javafx.scene.layout.VBox; @@ -212,6 +214,13 @@ public class StoreChoicePopover { popover.setAutoHide(!AppPrefs.get().limitedTouchscreenMode().get()); AppFontSizes.xs(popover.getContentNode()); + popover.addEventFilter(KeyEvent.KEY_PRESSED, event -> { + if (event.getCode() == KeyCode.ESCAPE) { + popover.hide(); + event.consume(); + } + }); + // Hide on connection creation dialog AppDialog.getModalOverlays().addListener((ListChangeListener) c -> { popover.hide(); diff --git a/app/src/main/java/io/xpipe/app/process/ElevationFunction.java b/app/src/main/java/io/xpipe/app/process/ElevationFunction.java index 2df77cf5d..e5bbc8862 100644 --- a/app/src/main/java/io/xpipe/app/process/ElevationFunction.java +++ b/app/src/main/java/io/xpipe/app/process/ElevationFunction.java @@ -71,6 +71,29 @@ public interface ElevationFunction { }; } + + static ElevationFunction cached(String key, ElevationFunction elevationFunction) { + return new ElevationFunction() { + @Override + public String getPrefix() { + return elevationFunction.getPrefix(); + } + + @Override + public boolean isSpecified() { + return elevationFunction.isSpecified(); + } + + @Override + public boolean apply(ShellControl shellControl) throws Exception { + var view = shellControl.view(); + return view.getCachedPredicate(key, () -> { + return elevationFunction.apply(shellControl); + }); + } + }; + } + static ElevationFunction none() { return new ElevationFunction() { @Override diff --git a/app/src/main/java/io/xpipe/app/storage/DataStorage.java b/app/src/main/java/io/xpipe/app/storage/DataStorage.java index 728c00a48..b77a9d6ea 100644 --- a/app/src/main/java/io/xpipe/app/storage/DataStorage.java +++ b/app/src/main/java/io/xpipe/app/storage/DataStorage.java @@ -1379,7 +1379,7 @@ public abstract class DataStorage { } if (!entry.getValidity().isUsable()) { - return "Unknown"; + return entry.getName(); } return entry.getProvider().displayName(entry); diff --git a/core/src/main/java/io/xpipe/core/FilePath.java b/core/src/main/java/io/xpipe/core/FilePath.java index 202956d64..e305d160c 100644 --- a/core/src/main/java/io/xpipe/core/FilePath.java +++ b/core/src/main/java/io/xpipe/core/FilePath.java @@ -94,7 +94,7 @@ public final class FilePath { } public FilePath removeTrailingSlash() { - if (value.equals("/")) { + if (value.equals("/") || value.equals("\\")) { return FilePath.of(value); } diff --git a/ext/system/src/main/java/io/xpipe/ext/system/incus/IncusCommandView.java b/ext/system/src/main/java/io/xpipe/ext/system/incus/IncusCommandView.java index c9b1bbde2..80f20deb2 100644 --- a/ext/system/src/main/java/io/xpipe/ext/system/incus/IncusCommandView.java +++ b/ext/system/src/main/java/io/xpipe/ext/system/incus/IncusCommandView.java @@ -21,7 +21,7 @@ public class IncusCommandView extends CommandViewBase { } private static ElevationFunction requiresElevation() { - return new ElevationFunction() { + return ElevationFunction.cached("incusRequiresElevation", new ElevationFunction() { @Override public String getPrefix() { return "Incus"; @@ -44,7 +44,7 @@ public class IncusCommandView extends CommandViewBase { + "test -S /var/lib/incus/unix.socket.user && test -w /var/lib/incus/unix.socket.user") .executeAndCheck(); } - }; + }); } private static String formatErrorMessage(String s) { diff --git a/ext/system/src/main/java/io/xpipe/ext/system/lxd/LxdCommandView.java b/ext/system/src/main/java/io/xpipe/ext/system/lxd/LxdCommandView.java index 9e025387c..d840a4fcc 100644 --- a/ext/system/src/main/java/io/xpipe/ext/system/lxd/LxdCommandView.java +++ b/ext/system/src/main/java/io/xpipe/ext/system/lxd/LxdCommandView.java @@ -22,7 +22,7 @@ public class LxdCommandView extends CommandViewBase { } private static ElevationFunction requiresElevation() { - return new ElevationFunction() { + return ElevationFunction.cached("lxdRequiresElevation", new ElevationFunction() { @Override public String getPrefix() { return "LXD"; @@ -44,7 +44,7 @@ public class LxdCommandView extends CommandViewBase { + ".socket && test -w /var/snap/lxd/common/lxd/unix.socket") .executeAndCheck(); } - }; + }); } private static String formatErrorMessage(String s) {