mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-21 23:20:23 +00:00
Fix term fallback
This commit is contained in:
parent
ec258a1eaa
commit
82b501d4cc
2 changed files with 12 additions and 7 deletions
|
@ -7,12 +7,14 @@ import io.xpipe.beacon.api.SshLaunchExchange;
|
||||||
import io.xpipe.core.process.ProcessControlProvider;
|
import io.xpipe.core.process.ProcessControlProvider;
|
||||||
import io.xpipe.core.process.ShellDialects;
|
import io.xpipe.core.process.ShellDialects;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class SshLaunchExchangeImpl extends SshLaunchExchange {
|
public class SshLaunchExchangeImpl extends SshLaunchExchange {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object handle(HttpExchange exchange, Request msg) throws Exception {
|
public Object handle(HttpExchange exchange, Request msg) throws Exception {
|
||||||
if ("echo $SHELL".equals(msg.getArguments())) {
|
if ("echo $SHELL".equals(msg.getArguments())) {
|
||||||
return "/bin/bash";
|
return Response.builder().command(List.of("echo", "/bin/bash")).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
var usedDialect = ShellDialects.getStartableDialects().stream()
|
var usedDialect = ShellDialects.getStartableDialects().stream()
|
||||||
|
|
|
@ -72,7 +72,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||||
|
|
||||||
static ExternalTerminalType determineNonSshBridgeFallback(ExternalTerminalType type) {
|
static ExternalTerminalType determineNonSshBridgeFallback(ExternalTerminalType type) {
|
||||||
if (type == XSHELL || type == MOBAXTERM || type == SECURECRT) {
|
if (type == XSHELL || type == MOBAXTERM || type == SECURECRT) {
|
||||||
return CMD;
|
return ProcessControlProvider.get().getEffectiveLocalDialect() == ShellDialects.CMD ? CMD : POWERSHELL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type != TERMIUS) {
|
if (type != TERMIUS) {
|
||||||
|
@ -90,7 +90,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||||
return MACOS_TERMINAL;
|
return MACOS_TERMINAL;
|
||||||
}
|
}
|
||||||
case OsType.Windows windows -> {
|
case OsType.Windows windows -> {
|
||||||
return CMD;
|
return ProcessControlProvider.get().getEffectiveLocalDialect() == ShellDialects.CMD ? CMD : POWERSHELL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -270,7 +270,10 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||||
.add("\"$(cygpath \"" + b.getIdentityKey().toString() + "\")\"")
|
.add("\"$(cygpath \"" + b.getIdentityKey().toString() + "\")\"")
|
||||||
.add("-p")
|
.add("-p")
|
||||||
.add("" + b.getPort());
|
.add("" + b.getPort());
|
||||||
var script = ScriptHelper.createExecScript(ShellDialects.BASH, sc, command.buildFull(sc));
|
// Don't use local shell to build as it uses cygwin
|
||||||
|
var rawCommand = command.buildSimple();
|
||||||
|
var script = ScriptHelper.getExecScriptFile(sc, "sh");
|
||||||
|
Files.writeString(Path.of(script.toString()), rawCommand);
|
||||||
var fixedFile = script
|
var fixedFile = script
|
||||||
.toString()
|
.toString()
|
||||||
.replaceAll("\\\\", "/")
|
.replaceAll("\\\\", "/")
|
||||||
|
@ -299,7 +302,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||||
yield CommandSupport.isInPathSilent(sc, "termius");
|
yield CommandSupport.isInPathSilent(sc, "termius");
|
||||||
}
|
}
|
||||||
case OsType.MacOs macOs -> {
|
case OsType.MacOs macOs -> {
|
||||||
yield CommandSupport.isInPathSilent(sc, "termius");
|
yield Files.exists(Path.of("/Applications/Termius.app"));
|
||||||
}
|
}
|
||||||
case OsType.Windows windows -> {
|
case OsType.Windows windows -> {
|
||||||
var r = WindowsRegistry.local()
|
var r = WindowsRegistry.local()
|
||||||
|
@ -1027,8 +1030,8 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||||
XTERM,
|
XTERM,
|
||||||
DEEPIN_TERMINAL,
|
DEEPIN_TERMINAL,
|
||||||
FOOT,
|
FOOT,
|
||||||
Q_TERMINAL,
|
Q_TERMINAL
|
||||||
TERMIUS);
|
);
|
||||||
List<ExternalTerminalType> MACOS_TERMINALS = List.of(
|
List<ExternalTerminalType> MACOS_TERMINALS = List.of(
|
||||||
KittyTerminalType.KITTY_MACOS,
|
KittyTerminalType.KITTY_MACOS,
|
||||||
WARP,
|
WARP,
|
||||||
|
|
Loading…
Reference in a new issue