From a88e222b50fc2f2ef641a1d2b7c239be95671e8e Mon Sep 17 00:00:00 2001 From: crschnick Date: Wed, 3 Sep 2025 23:23:18 +0000 Subject: [PATCH] Fix action shortcut issues --- .../xpipe/app/action/ActionShortcutComp.java | 7 ++++- .../xpipe/app/comp/base/InputGroupComp.java | 28 +++++++++++++++++++ .../io/xpipe/app/util/DesktopShortcuts.java | 5 ---- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/action/ActionShortcutComp.java b/app/src/main/java/io/xpipe/app/action/ActionShortcutComp.java index 793709fc0..70d65ebab 100644 --- a/app/src/main/java/io/xpipe/app/action/ActionShortcutComp.java +++ b/app/src/main/java/io/xpipe/app/action/ActionShortcutComp.java @@ -7,6 +7,7 @@ import io.xpipe.app.comp.base.ButtonComp; import io.xpipe.app.comp.base.InputGroupComp; import io.xpipe.app.comp.base.TextFieldComp; import io.xpipe.app.core.AppI18n; +import io.xpipe.app.core.AppInstallation; import io.xpipe.app.update.AppDistributionType; import io.xpipe.app.util.*; @@ -60,6 +61,7 @@ public class ActionShortcutComp extends SimpleComp { field.grow(true, false); field.apply(struc -> struc.get().setEditable(false)); var group = new InputGroupComp(List.of(field, copyButton)); + group.setHeightReference(copyButton); return group; } @@ -74,7 +76,8 @@ public class ActionShortcutComp extends SimpleComp { }); var copyButton = new ButtonComp(null, new FontIcon("mdi2f-file-move-outline"), () -> { ThreadHelper.runFailableAsync(() -> { - var file = DesktopShortcuts.createCliOpen(url.getValue(), name.getValue()); + var exec = AppInstallation.ofCurrent().getCliExecutablePath().toString(); + var file = DesktopShortcuts.create(exec, "open \"" + url.getValue() + "\"", name.getValue()); DesktopHelper.browseFileInDirectory(file); }); }) @@ -83,6 +86,7 @@ public class ActionShortcutComp extends SimpleComp { var field = new TextFieldComp(name); field.grow(true, false); var group = new InputGroupComp(List.of(field, copyButton)); + group.setHeightReference(copyButton); return group; } @@ -103,6 +107,7 @@ public class ActionShortcutComp extends SimpleComp { field.grow(true, false); field.apply(struc -> struc.get().setEditable(false)); var group = new InputGroupComp(List.of(field, copyButton)); + group.setHeightReference(copyButton); return group; } diff --git a/app/src/main/java/io/xpipe/app/comp/base/InputGroupComp.java b/app/src/main/java/io/xpipe/app/comp/base/InputGroupComp.java index a917d167e..86e64fdae 100644 --- a/app/src/main/java/io/xpipe/app/comp/base/InputGroupComp.java +++ b/app/src/main/java/io/xpipe/app/comp/base/InputGroupComp.java @@ -4,9 +4,12 @@ import io.xpipe.app.comp.Comp; import io.xpipe.app.comp.CompStructure; import io.xpipe.app.comp.SimpleCompStructure; +import io.xpipe.app.core.AppFontSizes; import javafx.geometry.Pos; import atlantafx.base.layout.InputGroup; +import javafx.scene.layout.Region; +import lombok.Setter; import java.util.List; @@ -14,6 +17,9 @@ public class InputGroupComp extends Comp> { private final List> entries; + @Setter + private Comp heightReference; + public InputGroupComp(List> comps) { entries = List.copyOf(comps); } @@ -30,6 +36,28 @@ public class InputGroupComp extends Comp> { b.getChildren().add(entry.createRegion()); } b.setAlignment(Pos.CENTER); + + if (heightReference != null && entries.contains(heightReference)) { + var refIndex = entries.indexOf(heightReference); + var ref = b.getChildren().get(refIndex); + if (ref instanceof Region refR) { + for (int i = 0; i < entries.size(); i++) { + if (i == refIndex) { + continue; + } + + var entry = b.getChildren().get(i); + if (!(entry instanceof Region entryR)) { + continue; + } + + entryR.minHeightProperty().bind(refR.heightProperty()); + entryR.maxHeightProperty().bind(refR.heightProperty()); + entryR.prefHeightProperty().bind(refR.heightProperty()); + } + } + } + return new SimpleCompStructure<>(b); } } diff --git a/app/src/main/java/io/xpipe/app/util/DesktopShortcuts.java b/app/src/main/java/io/xpipe/app/util/DesktopShortcuts.java index 846875181..21aac820e 100644 --- a/app/src/main/java/io/xpipe/app/util/DesktopShortcuts.java +++ b/app/src/main/java/io/xpipe/app/util/DesktopShortcuts.java @@ -123,11 +123,6 @@ public class DesktopShortcuts { return base; } - public static Path createCliOpen(String action, String name) throws Exception { - var exec = AppInstallation.ofCurrent().getCliExecutablePath().toString(); - return create(exec, "open " + action, name); - } - public static Path create(String executable, String args, String name) throws Exception { var compat = OsFileSystem.ofLocal().makeFileSystemCompatible(name); if (OsType.getLocal() == OsType.WINDOWS) {