Terminal fixes

This commit is contained in:
crschnick 2024-11-11 09:10:43 +00:00
parent bc90ee0529
commit c0db32a10d
3 changed files with 74 additions and 53 deletions

View file

@ -403,58 +403,8 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
ExternalTerminalType PWSH = new PwshTerminalType();
ExternalTerminalType GNOME_TERMINAL = new PathCheckType("app.gnomeTerminal", "gnome-terminal", true) {
@Override
public String getWebsite() {
return "https://help.gnome.org/users/gnome-terminal/stable/";
}
ExternalTerminalType GNOME_TERMINAL = new GnomeTerminalType();
@Override
public boolean supportsTabs() {
return false;
}
@Override
public boolean isRecommended() {
return false;
}
@Override
public boolean supportsColoredTitle() {
return false;
}
@Override
public void launch(LaunchConfiguration configuration) throws Exception {
try (ShellControl pc = LocalShell.getShell()) {
CommandSupport.isInPathOrThrow(
pc, executable, toTranslatedString().getValue(), null);
var toExecute = CommandBuilder.of()
.add(executable, "-v", "--title")
.addQuoted(configuration.getColoredTitle())
.add("--")
.addFile(configuration.getScriptFile())
// In order to fix this bug which also affects us:
// https://askubuntu.com/questions/1148475/launching-gnome-terminal-from-vscode
.envrironment("GNOME_TERMINAL_SCREEN", sc -> "");
pc.executeSimpleCommand(toExecute);
}
}
@Override
public FailableFunction<LaunchConfiguration, String, Exception> remoteLaunchCommand(
ShellDialect systemDialect) {
return launchConfiguration -> {
var toExecute = CommandBuilder.of()
.add(executable, "-v", "--title")
.addQuoted(launchConfiguration.getColoredTitle())
.add("--")
.addFile(launchConfiguration.getScriptFile());
return toExecute.buildSimple();
};
}
};
ExternalTerminalType KONSOLE = new SimplePathType("app.konsole", "konsole", true) {
@Override
@ -664,6 +614,12 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
}
};
ExternalTerminalType GUAKE = new SimplePathType("app.guake", "guake", true) {
@Override
public int getProcessHierarchyOffset() {
return 1;
}
@Override
public String getWebsite() {
return "https://github.com/Guake/guake";
@ -751,6 +707,12 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
}
};
ExternalTerminalType DEEPIN_TERMINAL = new SimplePathType("app.deepinTerminal", "deepin-terminal", true) {
@Override
public int getProcessHierarchyOffset() {
return 1;
}
@Override
public String getWebsite() {
return "https://www.deepin.org/en/original/deepin-terminal/";
@ -799,7 +761,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
@Override
protected CommandBuilder toCommand(LaunchConfiguration configuration) {
return CommandBuilder.of().add("-e").addQuoted(configuration.getColoredTitle());
return CommandBuilder.of().add("-e").add(configuration.getDialectLaunchCommand());
}
};
ExternalTerminalType MACOS_TERMINAL = new MacOsType("app.macosTerminal", "Terminal") {
@ -1132,4 +1094,5 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
protected abstract CommandBuilder toCommand(LaunchConfiguration configuration) throws Exception;
}
}

View file

@ -0,0 +1,58 @@
package io.xpipe.app.terminal;
import io.xpipe.app.util.CommandSupport;
import io.xpipe.app.util.LocalShell;
import io.xpipe.core.process.CommandBuilder;
import io.xpipe.core.process.ShellControl;
import io.xpipe.core.process.ShellDialect;
import io.xpipe.core.util.FailableFunction;
public class GnomeTerminalType extends ExternalTerminalType.PathCheckType implements TrackableTerminalType {
public GnomeTerminalType() {super("app.gnomeTerminal", "gnome-terminal", true);}
@Override
public String getWebsite() {
return "https://help.gnome.org/users/gnome-terminal/stable/";
}
@Override
public boolean supportsTabs() {
return false;
}
@Override
public boolean isRecommended() {
return false;
}
@Override
public boolean supportsColoredTitle() {
return false;
}
@Override
public void launch(LaunchConfiguration configuration) throws Exception {
try (ShellControl pc = LocalShell.getShell()) {
CommandSupport.isInPathOrThrow(pc, executable, toTranslatedString().getValue(), null);
var toExecute = CommandBuilder.of().add(executable, "-v", "--title").addQuoted(configuration.getColoredTitle()).add("--").addFile(
configuration.getScriptFile())
// In order to fix this bug which also affects us:
// https://askubuntu.com/questions/1148475/launching-gnome-terminal-from-vscode
.envrironment("GNOME_TERMINAL_SCREEN", sc -> "");
pc.executeSimpleCommand(toExecute);
}
}
@Override
public FailableFunction<LaunchConfiguration, String, Exception> remoteLaunchCommand(
ShellDialect systemDialect
) {
return launchConfiguration -> {
var toExecute = CommandBuilder.of().add(executable, "-v", "--title").addQuoted(launchConfiguration.getColoredTitle()).add("--").addFile(
launchConfiguration.getScriptFile());
return toExecute.buildSimple();
};
}
}

View file

@ -12,7 +12,7 @@ import io.xpipe.core.util.XPipeInstallation;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
public interface KittyTerminalType extends ExternalTerminalType {
public interface KittyTerminalType extends ExternalTerminalType, TrackableTerminalType {
ExternalTerminalType KITTY_LINUX = new Linux();
ExternalTerminalType KITTY_MACOS = new MacOs();