mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-05-03 19:30:31 +00:00
Rework
This commit is contained in:
@@ -10,21 +10,11 @@ public interface GhosttyTerminalType extends ExternalTerminalType, TrackableTerm
|
||||
ExternalTerminalType GHOSTTY_LINUX = new Linux();
|
||||
ExternalTerminalType GHOSTTY_MACOS = new MacOs();
|
||||
|
||||
@Override
|
||||
default TerminalOpenFormat getOpenFormat() {
|
||||
return TerminalOpenFormat.NEW_WINDOW;
|
||||
}
|
||||
|
||||
@Override
|
||||
default String getWebsite() {
|
||||
return "https://ghostty.org";
|
||||
}
|
||||
|
||||
@Override
|
||||
default boolean isRecommended() {
|
||||
return AppPrefs.get().terminalMultiplexer().getValue() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
default boolean useColoredTitle() {
|
||||
return true;
|
||||
@@ -32,6 +22,16 @@ public interface GhosttyTerminalType extends ExternalTerminalType, TrackableTerm
|
||||
|
||||
class Linux implements GhosttyTerminalType, ExternalApplicationType.PathApplication {
|
||||
|
||||
@Override
|
||||
public TerminalOpenFormat getOpenFormat() {
|
||||
return TerminalOpenFormat.NEW_WINDOW;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecommended() {
|
||||
return AppPrefs.get().terminalMultiplexer().getValue() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void launch(TerminalLaunchConfiguration configuration) throws Exception {
|
||||
var builder =
|
||||
@@ -57,14 +57,22 @@ public interface GhosttyTerminalType extends ExternalTerminalType, TrackableTerm
|
||||
|
||||
class MacOs implements ExternalApplicationType.MacApplication, GhosttyTerminalType {
|
||||
|
||||
@Override
|
||||
public TerminalOpenFormat getOpenFormat() {
|
||||
return TerminalOpenFormat.NEW_WINDOW_OR_TABBED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecommended() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public void launch(TerminalLaunchConfiguration configuration) throws Exception {
|
||||
LocalShell.getShell()
|
||||
.executeSimpleCommand(CommandBuilder.of()
|
||||
.add("open", "-n", "-a")
|
||||
.addQuoted(getApplicationName())
|
||||
.add("--args", "-e")
|
||||
.add(configuration.single().getDialectLaunchCommand()));
|
||||
CommandBuilder b = configuration.isPreferTabs() ?
|
||||
CommandBuilder.of().add("open", "-a").addQuoted(getApplicationName()).addFile(configuration.single().getScriptFile()) :
|
||||
CommandBuilder.of().add("open", "-n", "-a").addQuoted(getApplicationName()).add("--args", "-e").add(
|
||||
configuration.single().getDialectLaunchCommand());
|
||||
LocalShell.getShell().command(b).execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,7 +8,7 @@ public class ITerm2TerminalType implements ExternalApplicationType.MacApplicatio
|
||||
|
||||
@Override
|
||||
public TerminalOpenFormat getOpenFormat() {
|
||||
return TerminalOpenFormat.TABBED;
|
||||
return TerminalOpenFormat.NEW_WINDOW_OR_TABBED;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -30,7 +30,9 @@ public class ITerm2TerminalType implements ExternalApplicationType.MacApplicatio
|
||||
public void launch(TerminalLaunchConfiguration configuration) throws Exception {
|
||||
LocalShell.getShell()
|
||||
.executeSimpleCommand(CommandBuilder.of()
|
||||
.add("open", "-a")
|
||||
.add("open")
|
||||
.addIf(!configuration.isPreferTabs(), "-n")
|
||||
.add("-a")
|
||||
.addQuoted("iTerm.app")
|
||||
.addFile(configuration.single().getScriptFile()));
|
||||
}
|
||||
|
||||
@@ -25,7 +25,9 @@ public class MacOsTerminalType implements ExternalApplicationType.MacApplication
|
||||
public void launch(TerminalLaunchConfiguration configuration) throws Exception {
|
||||
LocalShell.getShell()
|
||||
.executeSimpleCommand(CommandBuilder.of()
|
||||
.add("open", "-a")
|
||||
.add("open")
|
||||
.addIf(!configuration.isPreferTabs(), "-n")
|
||||
.add("-a")
|
||||
.addQuoted("Terminal.app")
|
||||
.addFile(configuration.single().getScriptFile()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user