mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-05-03 19:30:31 +00:00
Small fixes
This commit is contained in:
@@ -85,6 +85,11 @@ public class ErrorEvent {
|
||||
|
||||
public static class ErrorEventBuilder {
|
||||
|
||||
public ErrorEventBuilder descriptionPrefix(String prefix) {
|
||||
this.description = this.description != null ? prefix + "\n\n" + this.description : prefix;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ErrorEventBuilder documentationLink(DocumentationLink documentationLink) {
|
||||
return link(documentationLink.getLink());
|
||||
}
|
||||
|
||||
@@ -34,37 +34,39 @@ public class WorkspaceCreationDialog {
|
||||
.apply(struc -> AppFontSizes.xs(struc.get()));
|
||||
var modal = ModalOverlay.of("workspaceCreationAlertTitle", content);
|
||||
modal.addButton(ModalButton.ok(() -> {
|
||||
if (name.get() == null || path.get() == null) {
|
||||
return;
|
||||
}
|
||||
ThreadHelper.runAsync(() -> {
|
||||
if (name.get() == null || path.get() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
var shortcutName = (AppProperties.get().isStaging() ? "XPipe PTB" : "XPipe") + " (" + name.get() + ")";
|
||||
var file =
|
||||
switch (OsType.getLocal()) {
|
||||
case OsType.Windows w -> {
|
||||
var exec = XPipeInstallation.getCurrentInstallationBasePath()
|
||||
.resolve(XPipeInstallation.getDaemonExecutablePath(w))
|
||||
.toString();
|
||||
yield DesktopShortcuts.create(
|
||||
exec,
|
||||
"-Dio.xpipe.app.dataDir=\"" + path.get().toString()
|
||||
+ "\" -Dio.xpipe.app.acceptEula=true",
|
||||
shortcutName);
|
||||
}
|
||||
default -> {
|
||||
var exec = XPipeInstallation.getCurrentInstallationBasePath()
|
||||
.resolve(XPipeInstallation.getRelativeCliExecutablePath(OsType.getLocal()))
|
||||
.toString();
|
||||
yield DesktopShortcuts.create(
|
||||
exec, "-d \"" + path.get().toString() + "\" --accept-eula", shortcutName);
|
||||
}
|
||||
};
|
||||
DesktopHelper.browseFileInDirectory(file);
|
||||
OperationMode.close();
|
||||
} catch (Exception e) {
|
||||
ErrorEventFactory.fromThrowable(e).handle();
|
||||
}
|
||||
try {
|
||||
var shortcutName = name.get();
|
||||
var file =
|
||||
switch (OsType.getLocal()) {
|
||||
case OsType.Windows w -> {
|
||||
var exec = XPipeInstallation.getCurrentInstallationBasePath()
|
||||
.resolve(XPipeInstallation.getDaemonExecutablePath(w))
|
||||
.toString();
|
||||
yield DesktopShortcuts.create(
|
||||
exec,
|
||||
"-Dio.xpipe.app.dataDir=\"" + path.get().toString()
|
||||
+ "\" -Dio.xpipe.app.acceptEula=true",
|
||||
shortcutName);
|
||||
}
|
||||
default -> {
|
||||
var exec = XPipeInstallation.getCurrentInstallationBasePath()
|
||||
.resolve(XPipeInstallation.getRelativeCliExecutablePath(OsType.getLocal()))
|
||||
.toString();
|
||||
yield DesktopShortcuts.create(
|
||||
exec, "open -d \"" + path.get().toString() + "\" --accept-eula", shortcutName);
|
||||
}
|
||||
};
|
||||
DesktopHelper.browseFileInDirectory(file);
|
||||
OperationMode.close();
|
||||
} catch (Exception e) {
|
||||
ErrorEventFactory.fromThrowable(e).handle();
|
||||
}
|
||||
});
|
||||
}));
|
||||
modal.show();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.xpipe.app.util;
|
||||
|
||||
import io.xpipe.app.process.CommandBuilder;
|
||||
import io.xpipe.app.process.OsFileSystem;
|
||||
import io.xpipe.core.FilePath;
|
||||
import io.xpipe.core.OsType;
|
||||
@@ -32,6 +33,8 @@ public class DesktopShortcuts {
|
||||
}
|
||||
|
||||
private static Path createLinuxShortcut(String executable, String args, String name) throws Exception {
|
||||
// Linux .desktop names are very restrictive
|
||||
var fixedName = name.replaceAll("[^\\w _]", "");
|
||||
var icon = XPipeInstallation.getLocalDefaultInstallationIcon();
|
||||
var content = String.format(
|
||||
"""
|
||||
@@ -44,10 +47,16 @@ public class DesktopShortcuts {
|
||||
Terminal=false
|
||||
Categories=Utility;Development;
|
||||
""",
|
||||
name, executable, args, icon);
|
||||
fixedName, executable, args, icon);
|
||||
var file = DesktopHelper.getDesktopDirectory().resolve(name + ".desktop");
|
||||
Files.writeString(file, content);
|
||||
file.toFile().setExecutable(true);
|
||||
|
||||
// Mark shortcuts as trusted on gnome
|
||||
LocalShell.getShell().command(CommandBuilder.of().add("gio", "set")
|
||||
.addFile(file).addQuoted("metadata::trusted").add("yes"))
|
||||
.executeAndCheck();
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
@@ -147,3 +147,4 @@ The HTTP API has been improved in various areas. The action system is integrated
|
||||
- Fix freeze after waking up the local system from a long hibernation
|
||||
- Fix application not starting up if some antivirus interfered with local socket connections
|
||||
- Fix kubectl apply changes functionality for pods not working
|
||||
- Fix custom workspaces not working on Linux
|
||||
|
||||
Reference in New Issue
Block a user