mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-09-19 22:01:12 +00:00
Various fixes
This commit is contained in:
parent
a974e7aac2
commit
04bca4295d
|
@ -3,14 +3,13 @@ package io.xpipe.app.browser.action;
|
|||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.fxcomps.impl.TooltipAugment;
|
||||
import io.xpipe.app.fxcomps.util.BindingsHelper;
|
||||
import io.xpipe.app.fxcomps.util.Shortcuts;
|
||||
import io.xpipe.app.util.BooleanScope;
|
||||
import io.xpipe.app.util.LicenseProvider;
|
||||
import io.xpipe.app.util.ThreadHelper;
|
||||
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.MenuItem;
|
||||
|
||||
import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -65,7 +64,13 @@ public interface LeafAction extends BrowserAction {
|
|||
default MenuItem toMenuItem(OpenFileSystemModel model, List<BrowserEntry> selected) {
|
||||
var name = getName(model, selected);
|
||||
var mi = new MenuItem();
|
||||
mi.textProperty().bind(name);
|
||||
mi.textProperty().bind(BindingsHelper.map(name, s -> {
|
||||
if (getProFeatureId() != null
|
||||
&& !LicenseProvider.get().getFeature(getProFeatureId()).isSupported()) {
|
||||
return s + " (Pro)";
|
||||
}
|
||||
return s;
|
||||
}));
|
||||
mi.setOnAction(event -> {
|
||||
ThreadHelper.runFailableAsync(() -> {
|
||||
BooleanScope.execute(model.getBusy(), () -> {
|
||||
|
@ -86,10 +91,8 @@ public interface LeafAction extends BrowserAction {
|
|||
mi.setMnemonicParsing(false);
|
||||
mi.setDisable(!isActive(model, selected));
|
||||
|
||||
if (getProFeatureId() != null
|
||||
&& !LicenseProvider.get().getFeature(getProFeatureId()).isSupported()) {
|
||||
if (getProFeatureId() != null && !LicenseProvider.get().getFeature(getProFeatureId()).isSupported()) {
|
||||
mi.setDisable(true);
|
||||
mi.setText(mi.getText() + " (Pro)");
|
||||
}
|
||||
|
||||
return mi;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
.bookmark-list > .categories {
|
||||
-fx-padding: 1em;
|
||||
-fx-background-color: -color-bg-subtle;
|
||||
-fx-background-color: -color-bg-default;
|
||||
-fx-border-color: -color-border-default;
|
||||
-fx-border-width: 0 0 1 0;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
-fx-border-color: -color-border-default;
|
||||
-fx-border-width: 1px 0 0 0;
|
||||
-fx-padding: 1em;
|
||||
-fx-background-color: -color-bg-subtle;
|
||||
-fx-background-color: -color-bg-default;
|
||||
}
|
||||
|
||||
.transfer .button {
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
}
|
||||
|
||||
.root:light .color-box.gray {
|
||||
-fx-background-color: derive(-color-bg-default, -2%);
|
||||
-fx-background-color: derive(-color-bg-default, -3%);
|
||||
-fx-border-color: derive(-color-border-default, -10%);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
.menu-button .context-menu > * > * {
|
||||
.store-header-bar .menu-button .context-menu > * > * {
|
||||
-fx-padding: 5px 10px 5px 10px;
|
||||
}
|
||||
|
||||
.menu-button .context-menu > * {
|
||||
.store-header-bar .menu-button .context-menu > * {
|
||||
-fx-padding: 0;
|
||||
}
|
||||
|
||||
.menu-button .context-menu {
|
||||
.store-header-bar .menu-button .context-menu {
|
||||
-fx-padding: 3px;
|
||||
-fx-background-radius: 4px;
|
||||
-fx-border-radius: 4px;
|
||||
|
|
|
@ -4,6 +4,7 @@ import io.xpipe.app.browser.action.LeafAction;
|
|||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.util.LocalShell;
|
||||
import io.xpipe.core.process.OsType;
|
||||
import io.xpipe.core.process.ShellControl;
|
||||
import io.xpipe.core.process.ShellDialect;
|
||||
|
@ -17,34 +18,34 @@ public class BrowseInNativeManagerAction implements LeafAction {
|
|||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) throws Exception {
|
||||
ShellControl sc = model.getFileSystem().getShell().get();
|
||||
ShellControl sc = model.getFileSystem().getShell().orElseThrow();
|
||||
ShellDialect d = sc.getShellDialect();
|
||||
for (BrowserEntry entry : entries) {
|
||||
var e = entry.getRawFileEntry().getPath();
|
||||
var localFile = sc.getLocalSystemAccess().translateToLocalSystemPath(e);
|
||||
switch (OsType.getLocal()) {
|
||||
case OsType.Windows windows -> {
|
||||
if (entry.getRawFileEntry().getKind() == FileKind.DIRECTORY) {
|
||||
sc.executeSimpleCommand("explorer " + d.fileArgument(localFile));
|
||||
} else {
|
||||
sc.executeSimpleCommand("explorer /select," + d.fileArgument(localFile));
|
||||
try (var local = LocalShell.getShell().start()) {
|
||||
switch (OsType.getLocal()) {
|
||||
case OsType.Windows windows -> {
|
||||
// Explorer does not support single quotes, so use normal quotes
|
||||
if (entry.getRawFileEntry().getKind() == FileKind.DIRECTORY) {
|
||||
local.executeSimpleCommand("explorer " + d.quoteArgument(localFile));
|
||||
} else {
|
||||
local.executeSimpleCommand("explorer /select," + d.quoteArgument(localFile));
|
||||
}
|
||||
}
|
||||
case OsType.Linux linux -> {
|
||||
var action = entry.getRawFileEntry().getKind() == FileKind.DIRECTORY ?
|
||||
"org.freedesktop.FileManager1.ShowFolders" :
|
||||
"org.freedesktop.FileManager1.ShowItems";
|
||||
var dbus = String.format("""
|
||||
dbus-send --session --print-reply --dest=org.freedesktop.FileManager1 --type=method_call /org/freedesktop/FileManager1 %s array:string:"file://%s" string:""
|
||||
""", action, localFile);
|
||||
local.executeSimpleCommand(dbus);
|
||||
}
|
||||
case OsType.MacOs macOs -> {
|
||||
local.executeSimpleCommand(
|
||||
"open " + (entry.getRawFileEntry().getKind() == FileKind.DIRECTORY ? "" : "-R ") + d.fileArgument(localFile));
|
||||
}
|
||||
}
|
||||
case OsType.Linux linux -> {
|
||||
var action = entry.getRawFileEntry().getKind() == FileKind.DIRECTORY
|
||||
? "org.freedesktop.FileManager1.ShowFolders"
|
||||
: "org.freedesktop.FileManager1.ShowItems";
|
||||
var dbus = String.format(
|
||||
"""
|
||||
dbus-send --session --print-reply --dest=org.freedesktop.FileManager1 --type=method_call /org/freedesktop/FileManager1 %s array:string:"file://%s" string:""
|
||||
""",
|
||||
action, localFile);
|
||||
sc.executeSimpleCommand(dbus);
|
||||
}
|
||||
case OsType.MacOs macOs -> {
|
||||
sc.executeSimpleCommand(
|
||||
"open " + (entry.getRawFileEntry().getKind() == FileKind.DIRECTORY ? "" : "-R ")
|
||||
+ d.fileArgument(localFile));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package io.xpipe.app.browser.action;
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.ApplicationPathAction;
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.core.process.ShellControl;
|
|
@ -1,7 +1,6 @@
|
|||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.BrowserActionFormatter;
|
||||
import io.xpipe.app.browser.action.MultiExecuteAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.icon.BrowserIconFileType;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.BrowserActionFormatter;
|
||||
import io.xpipe.app.browser.action.ToFileCommandAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.icon.BrowserIconFileType;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package io.xpipe.app.browser.action;
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.BranchAction;
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
|
@ -7,11 +9,8 @@ import io.xpipe.app.prefs.AppPrefs;
|
|||
import io.xpipe.app.util.TerminalLauncher;
|
||||
import io.xpipe.core.process.CommandBuilder;
|
||||
import io.xpipe.core.process.ShellControl;
|
||||
|
||||
import javafx.beans.value.ObservableValue;
|
||||
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class MultiExecuteAction implements BranchAction {
|
||||
|
@ -30,8 +29,7 @@ public abstract class MultiExecuteAction implements BranchAction {
|
|||
for (BrowserEntry entry : entries) {
|
||||
TerminalLauncher.open(
|
||||
model.getEntry().getEntry(),
|
||||
FilenameUtils.getBaseName(
|
||||
entry.getRawFileEntry().getPath()),
|
||||
entry.getRawFileEntry().getName(),
|
||||
model.getCurrentDirectory() != null
|
||||
? model.getCurrentDirectory()
|
||||
.getPath()
|
|
@ -40,7 +40,7 @@ public class RenameAction implements LeafAction {
|
|||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("openWithDefaultApplication");
|
||||
return AppI18n.observable("rename");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.MultiExecuteAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package io.xpipe.app.browser.action;
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.ApplicationPathAction;
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.util.FileOpener;
|
|
@ -1,6 +1,5 @@
|
|||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.ExecuteApplicationAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.icon.BrowserIconFileType;
|
||||
|
|
Loading…
Reference in a new issue