Add wezterm support

This commit is contained in:
crschnick 2024-01-18 02:14:36 +00:00
parent 2565bb250f
commit 298cd28872
2 changed files with 58 additions and 23 deletions

View file

@ -8,6 +8,7 @@ import io.xpipe.core.process.CommandBuilder;
import io.xpipe.core.process.OsType; import io.xpipe.core.process.OsType;
import io.xpipe.core.process.ShellControl; import io.xpipe.core.process.ShellControl;
import io.xpipe.core.store.FileNames; import io.xpipe.core.store.FileNames;
import io.xpipe.core.store.LocalStore;
import lombok.Getter; import lombok.Getter;
import lombok.Value; import lombok.Value;
@ -154,7 +155,6 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
} }
} }
Optional<Path> finalLocation = location;
execute(location.get(), configuration); execute(location.get(), configuration);
} }
@ -191,28 +191,39 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
} }
}; };
// ExternalTerminalType WEZ_WINDOWS = new WindowsType("app.wezWindows", "wezterm") { ExternalTerminalType WEZ_WINDOWS = new WindowsType("app.wezWindows", "wezterm-gui") {
//
// @Override @Override
// protected void execute(Path file, LaunchConfiguration configuration) throws Exception { protected void execute(Path file, LaunchConfiguration configuration) throws Exception {
// ThreadHelper.runFailableAsync(() -> { ThreadHelper.runFailableAsync(() -> {
// new LocalStore().control().command(CommandBuilder.of().addFile(file.toString()).add("start", "-e", new LocalStore().control().command(CommandBuilder.of().addFile(file.toString()).add("start").addFile(configuration.getScriptFile())).execute();
// "cmd", "/c").addFile(configuration.getScriptFile())).execute(); });
// }); }
// }
// @Override
// @Override protected Optional<Path> determineInstallation() {
// protected Optional<Path> determineInstallation() { Optional<String> launcherDir;
// Optional<String> launcherDir; launcherDir = WindowsRegistry.readString(
// launcherDir = WindowsRegistry.readString( WindowsRegistry.HKEY_LOCAL_MACHINE,
// WindowsRegistry.HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{BCF6F0DA-5B9A-408D-8562-F680AE6E1EAF}_is1",
// "InstallLocation")
// "Microsoft\\Windows\\CurrentVersion\\Uninstall\\{BCF6F0DA-5B9A-408D-8562-F680AE6E1EAF}_is1", .map(p -> p + "\\wezterm-gui.exe");
// "InstallLocation") return launcherDir.map(Path::of);
// .map(p -> p + "\\wezterm.exe"); }
// return launcherDir.map(Path::of); };
// }
// }; ExternalTerminalType WEZ_LINUX = new SimplePathType("app.wezLinux", "wezterm-gui") {
@Override
protected CommandBuilder toCommand(String name, String file) {
return CommandBuilder.of().add("start").addFile(file);
}
@Override
public boolean isSelectable() {
return OsType.getLocal().equals(OsType.LINUX);
}
};
// ExternalTerminalType HYPER_WINDOWS = new WindowsFullPathType("app.hyperWindows") { // ExternalTerminalType HYPER_WINDOWS = new WindowsFullPathType("app.hyperWindows") {
// //
@ -498,6 +509,24 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
} }
}; };
ExternalTerminalType WEZ_MACOS = new MacOsType("app.wezMacOs", "WezTerm") {
@Override
public boolean supportsColoredTitle() {
return false;
}
@Override
public void launch(LaunchConfiguration configuration) throws Exception {
LocalShell.getShell()
.executeSimpleCommand(CommandBuilder.of()
.add("open", "-a")
.addQuoted("WezTerm.app")
.add("start")
.addFile(configuration.getScriptFile()));
}
};
ExternalTerminalType KITTY_MACOS = new MacOsType("app.kittyMacOs", "kitty") { ExternalTerminalType KITTY_MACOS = new MacOsType("app.kittyMacOs", "kitty") {
@Override @Override
@ -540,10 +569,12 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
List<ExternalTerminalType> ALL = Stream.of( List<ExternalTerminalType> ALL = Stream.of(
TABBY_WINDOWS, TABBY_WINDOWS,
ALACRITTY_WINDOWS, ALACRITTY_WINDOWS,
WEZ_WINDOWS,
WINDOWS_TERMINAL, WINDOWS_TERMINAL,
PWSH_WINDOWS, PWSH_WINDOWS,
POWERSHELL_WINDOWS, POWERSHELL_WINDOWS,
CMD, CMD,
WEZ_LINUX,
KONSOLE, KONSOLE,
XFCE, XFCE,
ELEMENTARY, ELEMENTARY,
@ -564,6 +595,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
ALACRITTY_MACOS, ALACRITTY_MACOS,
KITTY_MACOS, KITTY_MACOS,
WARP, WARP,
WEZ_MACOS,
MACOS_TERMINAL, MACOS_TERMINAL,
CUSTOM) CUSTOM)
.filter(terminalType -> terminalType.isSelectable()) .filter(terminalType -> terminalType.isSelectable())

View file

@ -145,3 +145,6 @@ windowsTerminal=Windows Terminal
gnomeTerminal=Gnome Terminal gnomeTerminal=Gnome Terminal
createLock=Create lock createLock=Create lock
tilix=Tilix tilix=Tilix
wezWindows=WezTerm
wezLinux=WezTerm
wezMacOs=WezTerm