feat(agents): support Ghostty as default terminal on macOS

This commit is contained in:
Roomen authored and lzt404 committed 2026-09-18 18:17:31 +08:00
1 parent f4d91b59fc
commit 40e64b535e
1 file changed
+16
+16
View File
@@ -31,6 +31,14 @@ fn macos_iterm2_installed() -> bool {
.is_some_and(|home| home.join("Applications/iTerm.app").is_dir())
}
#[cfg(target_os = "macos")]
fn macos_ghostty_installed() -> bool {
Path::new("/Applications/Ghostty.app").is_dir()
|| env::var_os("HOME")
.map(PathBuf::from)
.is_some_and(|home| home.join("Applications/Ghostty.app").is_dir())
}
#[cfg(target_os = "linux")]
fn linux_terminal_definitions() -> &'static [(
&'static str,
@@ -69,6 +77,9 @@ pub(crate) fn available_agent_terminals() -> Vec<AgentTerminalOption> {
if macos_iterm2_installed() {
options.push(terminal_option("iterm2", "iTerm2"));
}
if macos_ghostty_installed() {
options.push(terminal_option("ghostty", "Ghostty"));
}
}
#[cfg(target_os = "windows")]
{
@@ -1178,6 +1189,11 @@ fn launch_cli_agent(
"tell application \"iTerm2\"\nactivate\nset newWindow to (create window with default profile)\ntell current session of newWindow\nwrite text \"{}\"\nend tell\nend tell",
command_line.replace('\\', "\\\\").replace('"', "\\\"")
)
} else if terminal == "ghostty" {
format!(
"tell application \"Ghostty\"\nactivate\nset surfaceConfig to new surface configuration\nset initial input of surfaceConfig to \"{}\\n\"\nnew window with configuration surfaceConfig\nend tell",
command_line.replace('\\', "\\\\").replace('"', "\\\"")
)
} else if matches!(terminal, "auto" | "terminal") {
format!(
"tell application \"Terminal\"\nactivate\ndo script \"{}\"\nend tell",