mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-07-08 15:56:09 +12:00
Fixes for mac integration
This commit is contained in:
parent
c3ad76959c
commit
6b80d4cda3
|
@ -73,14 +73,14 @@ public abstract class ExternalEditorType implements PrefsChoiceValue {
|
|||
public static final ExternalEditorType TEXT_EDIT = new MacOsFullPathType("app.textEdit") {
|
||||
@Override
|
||||
protected Path determinePath() {
|
||||
return Path.of("/Applications/TextEdit.app");
|
||||
return Path.of("/System/Applications/TextEdit.app");
|
||||
}
|
||||
};
|
||||
|
||||
public static final ExternalEditorType NOTEPADPP_MACOS = new MacOsFullPathType("app.notepad++") {
|
||||
@Override
|
||||
protected Path determinePath() {
|
||||
return Path.of("/Applications/TextEdit.app");
|
||||
return Path.of("/Applications/Notepad++.app");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@ import io.xpipe.extension.util.ApplicationHelper;
|
|||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
|
@ -98,7 +100,7 @@ public abstract class TerminalType implements PrefsChoiceValue {
|
|||
|
||||
public static final TerminalType MACOS_TERMINAL = new MacType("proc.macosTerminal", "Terminal");
|
||||
|
||||
public static final TerminalType ITERM2 = new MacType("proc.iterm2", "iTerm2");
|
||||
public static final TerminalType ITERM2 = new ITerm2Type();
|
||||
|
||||
public static final TerminalType WARP = new MacType("proc.warp", "Warp");
|
||||
|
||||
|
@ -178,6 +180,39 @@ public abstract class TerminalType implements PrefsChoiceValue {
|
|||
}
|
||||
}
|
||||
|
||||
static class ITerm2Type extends TerminalType {
|
||||
|
||||
public ITerm2Type() {
|
||||
super("proc.iterm2");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void launch(String name, String command) throws Exception {
|
||||
try (ShellProcessControl pc = ShellStore.local().create().start()) {
|
||||
var cmd = String.format("""
|
||||
osascript - "$@" <<EOF
|
||||
on run argv
|
||||
tell application "iTerm"
|
||||
activate
|
||||
set new_term to (create window with profile "Default" command "%s")
|
||||
end tell
|
||||
end run
|
||||
EOF""", command);
|
||||
pc.executeSimpleCommand(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelectable() {
|
||||
return OsType.getLocal().equals(OsType.MAC);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return Files.exists(Path.of("/Applications/iTerm2.app"));
|
||||
}
|
||||
}
|
||||
|
||||
public abstract static class SimpleType extends TerminalType {
|
||||
|
||||
private final String executable;
|
||||
|
|
Loading…
Reference in a new issue