mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-06-28 11:00:28 +12:00
Rework init commands for warp
This commit is contained in:
parent
73bc99b3c6
commit
0a3488324d
|
@ -575,6 +575,20 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
|||
return toExecute.buildSimple();
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String additionalInitCommands(ShellControl sc) {
|
||||
if (sc.getShellDialect() == ShellDialects.ZSH) {
|
||||
return "printf '\\eP$f{\"hook\": \"SourcedRcFileForWarp\", \"value\": { \"shell\": \"zsh\"}}\\x9c'";
|
||||
}
|
||||
if (sc.getShellDialect() == ShellDialects.BASH) {
|
||||
return "printf '\\eP$f{\"hook\": \"SourcedRcFileForWarp\", \"value\": { \"shell\": \"bash\"}}\\x9c'";
|
||||
}
|
||||
if (sc.getShellDialect() == ShellDialects.FISH) {
|
||||
return "printf '\\eP$f{\"hook\": \"SourcedRcFileForWarp\", \"value\": { \"shell\": \"fish\"}}\\x9c'";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
ExternalTerminalType CUSTOM = new CustomTerminalType();
|
||||
List<ExternalTerminalType> WINDOWS_TERMINALS = List.of(
|
||||
|
@ -656,6 +670,10 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
|||
.orElse(null);
|
||||
}
|
||||
|
||||
default String additionalInitCommands(ShellControl sc) {
|
||||
return null;
|
||||
}
|
||||
|
||||
boolean supportsTabs();
|
||||
|
||||
default String getWebsite() {
|
||||
|
|
|
@ -31,7 +31,8 @@ public class TerminalLauncher {
|
|||
new TerminalInitScriptConfig(
|
||||
title,
|
||||
type.shouldClear()
|
||||
&& AppPrefs.get().clearTerminalOnInit().get()));
|
||||
&& AppPrefs.get().clearTerminalOnInit().get(),
|
||||
type.additionalInitCommands(sc)));
|
||||
var config = new ExternalTerminalType.LaunchConfiguration(null, title, title, script, sc.getShellDialect());
|
||||
type.launch(config);
|
||||
}
|
||||
|
@ -53,7 +54,8 @@ public class TerminalLauncher {
|
|||
var adjustedTitle = prefix + cleanTitle;
|
||||
var terminalConfig = new TerminalInitScriptConfig(
|
||||
adjustedTitle,
|
||||
type.shouldClear() && AppPrefs.get().clearTerminalOnInit().get());
|
||||
type.shouldClear() && AppPrefs.get().clearTerminalOnInit().get(),
|
||||
cc instanceof ShellControl sc ? type.additionalInitCommands(sc) : null);
|
||||
|
||||
var request = UUID.randomUUID();
|
||||
var d = ProcessControlProvider.get().getEffectiveLocalDialect();
|
||||
|
|
|
@ -7,8 +7,9 @@ public class TerminalInitScriptConfig {
|
|||
|
||||
String displayName;
|
||||
boolean clearScreen;
|
||||
String terminalSpecificCommands;
|
||||
|
||||
public static TerminalInitScriptConfig ofName(String name) {
|
||||
return new TerminalInitScriptConfig(name, true);
|
||||
return new TerminalInitScriptConfig(name, true, null);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue