mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-09-23 11:36:08 -04:00
Fix terminal selection resetting to uninstalled Warp (#924)
This commit is contained in:
1 parent
f238c5b257
commit
f5e109ab41
2 files changed
+21
-1
No files matched your search
@@ -9,6 +9,7 @@ import io.xpipe.app.webtop.WebtopApp;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.InvalidPathException;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public interface WarpTerminalType extends ExternalTerminalType, TrackableTerminalType {
|
||||
@@ -57,7 +58,20 @@ public interface WarpTerminalType extends ExternalTerminalType, TrackableTermina
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return WindowsRegistry.local().keyExists(WindowsRegistry.HKEY_CURRENT_USER, "Software\\Classes\\warp");
|
||||
// The uninstaller leaves the protocol handler key behind
|
||||
var command = WindowsRegistry.local()
|
||||
.readStringValueIfPresent(
|
||||
WindowsRegistry.HKEY_CURRENT_USER, "Software\\Classes\\warp\\shell\\open\\command", null);
|
||||
if (command.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
var split = command.get().split("\"");
|
||||
return split.length > 1 && Files.exists(Path.of(split[1]));
|
||||
} catch (InvalidPathException ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -181,6 +181,12 @@ public interface WindowsTerminalType extends ExternalTerminalType, TrackableTerm
|
||||
super("app.windowsTerminal", "wt.exe", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
// The executable is a weird link
|
||||
return Files.exists(getPath().getParent()) || super.isAvailable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void launch(TerminalLaunchConfiguration configuration) throws Exception {
|
||||
checkProfile();
|
||||
|
||||
Reference in new issue
Block a user