Some fixes for VNC

This commit is contained in:
crschnick 2024-09-05 14:12:53 +00:00
parent fa2a23ab36
commit 0daec42954
3 changed files with 21 additions and 4 deletions

View file

@ -1,9 +1,11 @@
package io.xpipe.app.util; package io.xpipe.app.util;
import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.issue.ErrorEvent;
import io.xpipe.core.process.CommandBuilder;
import io.xpipe.core.process.OsType; import io.xpipe.core.process.OsType;
import io.xpipe.core.process.ShellControl; import io.xpipe.core.process.ShellControl;
import io.xpipe.core.store.FileKind; import io.xpipe.core.store.FileKind;
import io.xpipe.core.store.FilePath;
import java.awt.*; import java.awt.*;
import java.nio.file.Files; import java.nio.file.Files;
@ -64,7 +66,13 @@ public class DesktopHelper {
dbus-send --session --print-reply --dest=org.freedesktop.FileManager1 --type=method_call /org/freedesktop/FileManager1 %s array:string:"file://%s" string:"" dbus-send --session --print-reply --dest=org.freedesktop.FileManager1 --type=method_call /org/freedesktop/FileManager1 %s array:string:"file://%s" string:""
""", """,
action, path); action, path);
sc.executeSimpleCommand(dbus); var success = sc.executeSimpleBooleanCommand(dbus);
if (success) {
return;
}
var file = new FilePath(path);
sc.command(CommandBuilder.of().add("xdg-open").addFile(kind == FileKind.DIRECTORY ? file : file.getParent())).execute();
} }
case OsType.MacOs macOs -> { case OsType.MacOs macOs -> {
sc.executeSimpleCommand("open " + (kind == FileKind.DIRECTORY ? "" : "-R ") + d.fileArgument(path)); sc.executeSimpleCommand("open " + (kind == FileKind.DIRECTORY ? "" : "-R ") + d.fileArgument(path));

View file

@ -5,10 +5,13 @@ import io.xpipe.app.browser.file.BrowserEntry;
import io.xpipe.app.browser.fs.OpenFileSystemModel; import io.xpipe.app.browser.fs.OpenFileSystemModel;
import io.xpipe.app.core.AppI18n; import io.xpipe.app.core.AppI18n;
import io.xpipe.app.util.LocalShell; import io.xpipe.app.util.LocalShell;
import io.xpipe.core.process.CommandBuilder;
import io.xpipe.core.process.OsType; import io.xpipe.core.process.OsType;
import io.xpipe.core.process.ShellControl; import io.xpipe.core.process.ShellControl;
import io.xpipe.core.store.FileKind;
import io.xpipe.core.store.FileNames; import io.xpipe.core.store.FileNames;
import io.xpipe.core.store.FilePath;
import javafx.beans.value.ObservableValue; import javafx.beans.value.ObservableValue;
import javafx.scene.input.KeyCode; import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyCodeCombination; import javafx.scene.input.KeyCodeCombination;
@ -47,10 +50,16 @@ public class OpenNativeFileDetailsAction implements LeafAction {
case OsType.Linux linux -> { case OsType.Linux linux -> {
var dbus = String.format( var dbus = String.format(
""" """
dbus-send --session --print-reply --dest=org.freedesktop.FileManager1 --type=method_call /org/freedesktop/FileManager1 org.freedesktop.FileManager1.ShowItemProperties array:string:"file://%s" string:"" dbus-send --session --print-reply --dest=org.freedesktop.FileManager1 --type=method_call /org/freedesktop/FileManager1 org.freedesktop.FileManager1.ShowItemProperties array:string:"file://%s" string:""
""", """,
localFile); localFile);
sc.executeSimpleCommand(dbus); var success = sc.executeSimpleBooleanCommand(dbus);
if (success) {
return;
}
var file = new FilePath(e);
sc.command(CommandBuilder.of().add("xdg-open").addFile(entry.getRawFileEntry().getKind() == FileKind.DIRECTORY ? file : file.getParent())).execute();
} }
case OsType.MacOs macOs -> { case OsType.MacOs macOs -> {
sc.osascriptCommand(String.format( sc.osascriptCommand(String.format(