mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-06-22 14:29:18 -04:00
Add more terminals plus various small improvements [stage]
This commit is contained in:
@@ -282,12 +282,8 @@ public final class OpenFileSystemModel {
|
||||
});
|
||||
}
|
||||
|
||||
public void createFileAsync(String name) {
|
||||
if (name == null || name.isBlank()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (getCurrentDirectory() == null) {
|
||||
public void createLinkAsync(String linkName, String targetFile) {
|
||||
if (linkName == null || linkName.isBlank() || targetFile == null || targetFile.isBlank()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -297,6 +293,32 @@ public final class OpenFileSystemModel {
|
||||
return;
|
||||
}
|
||||
|
||||
if (getCurrentDirectory() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
var abs = FileNames.join(getCurrentDirectory().getPath(), linkName);
|
||||
fileSystem.symbolicLink(abs, targetFile);
|
||||
refreshSync();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public void createFileAsync(String name) {
|
||||
if (name == null || name.isBlank()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ThreadHelper.runFailableAsync(() -> {
|
||||
BusyProperty.execute(busy, () -> {
|
||||
if (fileSystem == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (getCurrentDirectory() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
var abs = FileNames.join(getCurrentDirectory().getPath(), name);
|
||||
fileSystem.touch(abs);
|
||||
refreshSync();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.xpipe.app.core;
|
||||
|
||||
import io.xpipe.app.comp.base.ModalOverlayComp;
|
||||
import io.xpipe.app.ext.PrefsChoiceValue;
|
||||
import io.xpipe.app.fxcomps.impl.FancyTooltipAugment;
|
||||
import io.xpipe.app.issue.ErrorEvent;
|
||||
@@ -131,6 +132,7 @@ public class AppI18n {
|
||||
for (Class<?> caller : callers) {
|
||||
if (caller.equals(CallingClass.class)
|
||||
|| caller.equals(ModuleHelper.class)
|
||||
|| caller.equals(ModalOverlayComp.class)
|
||||
|| caller.equals(AppI18n.class)
|
||||
|| caller.equals(FancyTooltipAugment.class)
|
||||
|| caller.equals(PrefsChoiceValue.class)
|
||||
|
||||
@@ -51,6 +51,14 @@ public abstract class Comp<S extends CompStructure<?>> {
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public Comp<S> prefWidth(int width) {
|
||||
return apply(struc -> struc.get().setPrefWidth(width));
|
||||
}
|
||||
|
||||
public Comp<S> prefHeight(int height) {
|
||||
return apply(struc -> struc.get().setPrefHeight(height));
|
||||
}
|
||||
|
||||
public Comp<S> hgrow() {
|
||||
return apply(struc -> HBox.setHgrow(struc.get(), Priority.ALWAYS));
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import io.xpipe.app.util.ScriptHelper;
|
||||
import io.xpipe.app.util.WindowsRegistry;
|
||||
import io.xpipe.core.impl.FileNames;
|
||||
import io.xpipe.core.impl.LocalStore;
|
||||
import io.xpipe.core.process.CommandBuilder;
|
||||
import io.xpipe.core.process.OsType;
|
||||
import io.xpipe.core.process.ShellControl;
|
||||
import io.xpipe.core.process.ShellDialects;
|
||||
@@ -21,7 +22,7 @@ import java.util.stream.Stream;
|
||||
|
||||
public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||
|
||||
ExternalTerminalType CMD = new SimpleType("app.cmd", "cmd.exe", "cmd.exe") {
|
||||
ExternalTerminalType CMD = new SimpleType("app.cmd", "cmd.exe") {
|
||||
|
||||
@Override
|
||||
protected String toCommand(String name, String file) {
|
||||
@@ -34,7 +35,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||
}
|
||||
};
|
||||
|
||||
ExternalTerminalType POWERSHELL_WINDOWS = new SimpleType("app.powershell", "powershell", "PowerShell") {
|
||||
ExternalTerminalType POWERSHELL_WINDOWS = new SimpleType("app.powershell", "powershell") {
|
||||
|
||||
@Override
|
||||
protected String toCommand(String name, String file) {
|
||||
@@ -47,7 +48,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||
}
|
||||
};
|
||||
|
||||
ExternalTerminalType PWSH_WINDOWS = new SimpleType("app.pwsh", "pwsh", "PowerShell Core") {
|
||||
ExternalTerminalType PWSH_WINDOWS = new SimpleType("app.pwsh", "pwsh") {
|
||||
|
||||
@Override
|
||||
protected String toCommand(String name, String file) {
|
||||
@@ -62,7 +63,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||
}
|
||||
};
|
||||
|
||||
ExternalTerminalType WINDOWS_TERMINAL = new SimpleType("app.windowsTerminal", "wt.exe", "Windows Terminal") {
|
||||
ExternalTerminalType WINDOWS_TERMINAL = new SimpleType("app.windowsTerminal", "wt.exe") {
|
||||
|
||||
@Override
|
||||
protected String toCommand(String name, String file) {
|
||||
@@ -120,12 +121,12 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||
}
|
||||
};
|
||||
|
||||
ExternalTerminalType GNOME_TERMINAL = new SimpleType("app.gnomeTerminal", "gnome-terminal", "Gnome Terminal") {
|
||||
ExternalTerminalType GNOME_TERMINAL = new SimpleType("app.gnomeTerminal", "gnome-terminal") {
|
||||
|
||||
@Override
|
||||
public void launch(String name, String file, boolean elevated) throws Exception {
|
||||
try (ShellControl pc = LocalStore.getShell()) {
|
||||
ApplicationHelper.checkSupport(pc, executable, getDisplayName(), null);
|
||||
ApplicationHelper.checkSupport(pc, executable, toTranslatedString(), null);
|
||||
|
||||
var toExecute = executable + " " + toCommand(name, file);
|
||||
// In order to fix this bug which also affects us:
|
||||
@@ -146,7 +147,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||
}
|
||||
};
|
||||
|
||||
ExternalTerminalType KONSOLE = new SimpleType("app.konsole", "konsole", "Konsole") {
|
||||
ExternalTerminalType KONSOLE = new SimpleType("app.konsole", "konsole") {
|
||||
|
||||
@Override
|
||||
protected String toCommand(String name, String file) {
|
||||
@@ -162,7 +163,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||
}
|
||||
};
|
||||
|
||||
ExternalTerminalType XFCE = new SimpleType("app.xfce", "xfce4-terminal", "Xfce") {
|
||||
ExternalTerminalType XFCE = new SimpleType("app.xfce", "xfce4-terminal") {
|
||||
|
||||
@Override
|
||||
protected String toCommand(String name, String file) {
|
||||
@@ -175,6 +176,97 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||
}
|
||||
};
|
||||
|
||||
ExternalTerminalType TERMINATOR = new SimpleType("app.terminator", "terminator") {
|
||||
|
||||
@Override
|
||||
protected String toCommand(String name, String file) {
|
||||
return CommandBuilder.of().add("-e").addQuoted(file).add("-T").addQuoted(name).add("--new-tab").build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelectable() {
|
||||
return OsType.getLocal().equals(OsType.LINUX);
|
||||
}
|
||||
};
|
||||
|
||||
ExternalTerminalType KITTY = new SimpleType("app.kitty", "kitty") {
|
||||
|
||||
@Override
|
||||
protected String toCommand(String name, String file) {
|
||||
return CommandBuilder.of().add("-T").addQuoted(name).addQuoted(file).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelectable() {
|
||||
return OsType.getLocal().equals(OsType.LINUX);
|
||||
}
|
||||
};
|
||||
|
||||
ExternalTerminalType TERMINOLOGY = new SimpleType("app.terminology", "terminology") {
|
||||
|
||||
@Override
|
||||
protected String toCommand(String name, String file) {
|
||||
return CommandBuilder.of().add("-T").addQuoted(name).add("-2").add("-e").addQuoted(file).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelectable() {
|
||||
return OsType.getLocal().equals(OsType.LINUX);
|
||||
}
|
||||
};
|
||||
|
||||
ExternalTerminalType COOL_RETRO_TERM = new SimpleType("app.coolRetroTerm", "cool-retro-term") {
|
||||
|
||||
@Override
|
||||
protected String toCommand(String name, String file) {
|
||||
return CommandBuilder.of().add("-T").addQuoted(name).add("-e").addQuoted(file).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelectable() {
|
||||
return OsType.getLocal().equals(OsType.LINUX);
|
||||
}
|
||||
};
|
||||
|
||||
ExternalTerminalType GUAKE = new SimpleType("app.guake", "guake") {
|
||||
|
||||
@Override
|
||||
protected String toCommand(String name, String file) {
|
||||
return CommandBuilder.of().add("-r").addQuoted(name).add("-e").addQuoted(file).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelectable() {
|
||||
return OsType.getLocal().equals(OsType.LINUX);
|
||||
}
|
||||
};
|
||||
|
||||
ExternalTerminalType ALACRITTY = new SimpleType("app.alacritty", "alacritty") {
|
||||
|
||||
@Override
|
||||
protected String toCommand(String name, String file) {
|
||||
return CommandBuilder.of().add("-t").addQuoted(name).add("-e").addQuoted(file).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelectable() {
|
||||
return OsType.getLocal().equals(OsType.LINUX);
|
||||
}
|
||||
};
|
||||
|
||||
ExternalTerminalType TILDA = new SimpleType("app.tilda", "tilda") {
|
||||
|
||||
@Override
|
||||
protected String toCommand(String name, String file) {
|
||||
return CommandBuilder.of().add("-c").addQuoted(file).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelectable() {
|
||||
return OsType.getLocal().equals(OsType.LINUX);
|
||||
}
|
||||
};
|
||||
|
||||
ExternalTerminalType MACOS_TERMINAL = new MacOsTerminalType();
|
||||
|
||||
ExternalTerminalType ITERM2 = new ITerm2Type();
|
||||
@@ -194,6 +286,13 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||
KONSOLE,
|
||||
XFCE,
|
||||
GNOME_TERMINAL,
|
||||
TERMINATOR,
|
||||
KITTY,
|
||||
TERMINOLOGY,
|
||||
COOL_RETRO_TERM,
|
||||
GUAKE,
|
||||
ALACRITTY,
|
||||
TILDA,
|
||||
ITERM2,
|
||||
TABBY_MAC_OS,
|
||||
WARP,
|
||||
@@ -357,11 +456,8 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||
@Getter
|
||||
abstract class SimpleType extends ExternalApplicationType.PathApplication implements ExternalTerminalType {
|
||||
|
||||
private final String displayName;
|
||||
|
||||
public SimpleType(String id, String executable, String displayName) {
|
||||
public SimpleType(String id, String executable) {
|
||||
super(id, executable);
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -371,7 +467,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||
try (ShellControl pc = LocalStore.getShell()
|
||||
.subShell(ShellDialects.POWERSHELL)
|
||||
.start()) {
|
||||
ApplicationHelper.checkSupport(pc, executable, displayName, null);
|
||||
ApplicationHelper.checkSupport(pc, executable, toTranslatedString(), null);
|
||||
var toExecute = "Start-Process \"" + executable + "\" -Verb RunAs -ArgumentList \""
|
||||
+ toCommand(name, file).replaceAll("\"", "`\"") + "\"";
|
||||
pc.executeSimpleCommand(toExecute);
|
||||
@@ -381,7 +477,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||
}
|
||||
|
||||
try (ShellControl pc = LocalStore.getShell()) {
|
||||
ApplicationHelper.checkSupport(pc, executable, displayName, null);
|
||||
ApplicationHelper.checkSupport(pc, executable, toTranslatedString(), null);
|
||||
|
||||
var toExecute = executable + " " + toCommand(name, file);
|
||||
if (pc.getOsType().equals(OsType.WINDOWS)) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.xpipe.app.util;
|
||||
|
||||
import atlantafx.base.controls.Spacer;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.fxcomps.Comp;
|
||||
import io.xpipe.app.fxcomps.impl.*;
|
||||
@@ -7,6 +8,7 @@ import io.xpipe.core.util.SecretValue;
|
||||
import javafx.beans.property.Property;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.geometry.Orientation;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.layout.Region;
|
||||
import net.synedra.validatorfx.Check;
|
||||
@@ -108,6 +110,10 @@ public class OptionsBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
public OptionsBuilder spacer(double size) {
|
||||
return addComp(Comp.of(() -> new Spacer(size, Orientation.VERTICAL)));
|
||||
}
|
||||
|
||||
public OptionsBuilder name(String nameKey) {
|
||||
finishCurrent();
|
||||
name = AppI18n.observable(nameKey);
|
||||
|
||||
Reference in New Issue
Block a user