diff --git a/ext/base/src/main/java/io/xpipe/ext/base/browser/OpenFileWithAction.java b/ext/base/src/main/java/io/xpipe/ext/base/browser/OpenFileWithAction.java index ab4b93f3..bd7f0d9a 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/browser/OpenFileWithAction.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/browser/OpenFileWithAction.java @@ -6,6 +6,8 @@ import io.xpipe.app.browser.FileBrowserEntry; import io.xpipe.app.browser.OpenFileSystemModel; import io.xpipe.app.browser.action.LeafAction; import io.xpipe.core.process.OsType; +import io.xpipe.core.process.ShellControl; +import io.xpipe.core.process.ShellDialect; import javafx.scene.Node; import javafx.scene.input.KeyCode; import javafx.scene.input.KeyCodeCombination; @@ -30,7 +32,9 @@ public class OpenFileWithAction implements LeafAction { WinUser.SW_SHOWNORMAL); } case OsType.Linux linux -> { - throw new UnsupportedOperationException(); + ShellControl sc = model.getFileSystem().getShell().get(); + ShellDialect d = sc.getShellDialect(); + sc.executeSimpleCommand("mimeopen -a " + d.fileArgument(entries.get(0).getRawFileEntry().getPath())); } case OsType.MacOs macOs -> { throw new UnsupportedOperationException(); @@ -52,7 +56,7 @@ public class OpenFileWithAction implements LeafAction { public boolean isApplicable(OpenFileSystemModel model, List entries) { var os = model.getFileSystem().getShell(); return os.isPresent() - && os.get().getOsType().equals(OsType.WINDOWS) + && !os.get().getOsType().equals(OsType.MACOS) && entries.size() == 1 && entries.stream().noneMatch(entry -> entry.getRawFileEntry().isDirectory()); } diff --git a/ext/base/src/main/java/io/xpipe/ext/base/browser/OpenInNativeManagerAction.java b/ext/base/src/main/java/io/xpipe/ext/base/browser/OpenInNativeManagerAction.java index eb7d38a9..019d9fd4 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/browser/OpenInNativeManagerAction.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/browser/OpenInNativeManagerAction.java @@ -22,9 +22,10 @@ public class OpenInNativeManagerAction implements LeafAction { sc.executeSimpleCommand("explorer " + d.fileArgument(e)); } case OsType.Linux linux -> { + var action = entry.getRawFileEntry().isDirectory() ? "org.freedesktop.FileManager1.ShowFolders" : "org.freedesktop.FileManager1.ShowFiles"; var dbus = String.format(""" - dbus-send --session --print-reply --dest=org.freedesktop.FileManager1 --type=method_call /org/freedesktop/FileManager1 org.freedesktop.FileManager1.ShowItems array:string:"file://%s" string:"" - """, entry.getRawFileEntry().getPath()); + dbus-send --session --print-reply --dest=org.freedesktop.FileManager1 --type=method_call /org/freedesktop/FileManager1 %s array:string:"file://%s" string:"" + """, action, entry.getRawFileEntry().getPath()); sc.executeSimpleCommand(dbus); } case OsType.MacOs macOs -> { diff --git a/ext/base/src/main/java/io/xpipe/ext/base/browser/OpenNativeFileDetailsAction.java b/ext/base/src/main/java/io/xpipe/ext/base/browser/OpenNativeFileDetailsAction.java index 9f08643d..e8b13108 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/browser/OpenNativeFileDetailsAction.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/browser/OpenNativeFileDetailsAction.java @@ -29,7 +29,10 @@ public class OpenNativeFileDetailsAction implements LeafAction { } } case OsType.Linux linux -> { - throw new UnsupportedOperationException(); + 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:"" + """, entry.getRawFileEntry().getPath()); + sc.executeSimpleCommand(dbus); } case OsType.MacOs macOs -> { sc.osascriptCommand(String.format( @@ -56,7 +59,7 @@ public class OpenNativeFileDetailsAction implements LeafAction { @Override public boolean isApplicable(OpenFileSystemModel model, List entries) { var os = model.getFileSystem().getShell(); - return os.isPresent() && !os.get().getOsType().equals(OsType.LINUX); + return os.isPresent(); } @Override