Skip to content

Commit 7677aa2

Browse files
committed
feat: add Ghostty as a supported SSH/Telnet terminal on macOS
Adds a new built-in macOS plugin for Ghostty alongside Terminal.app and iTerm2. Ghostty has no "do script" AppleEvent, so the SSH launch path drives it through its own AppleScript dictionary instead of `open -na --args`, which avoids a security confirmation dialog and a broken extra tab that appear once Ghostty is already running. Repeat connections land as tabs in the existing window instead of new windows.
1 parent ff6eddd commit 7677aa2

10 files changed

Lines changed: 69 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ sudo dnf install ./jumpserver-client_*.rpm
111111

112112
### Supported Connection Types
113113

114-
- **SSH/Telnet** - Terminal connections (PuTTY, XShell, SecureCRT, iTerm2)
114+
- **SSH/Telnet** - Terminal connections (PuTTY, XShell, SecureCRT, iTerm2, Ghostty)
115115
- **RDP** - Remote Desktop Protocol for Windows servers
116116
- **VNC** - Virtual Network Computing for remote desktop access
117117
- **Database Connections**:

README_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ sudo dnf install ./jumpserver-client_*.rpm
107107

108108
### 支持的连接类型
109109

110-
- **SSH/Telnet** - 终端连接(PuTTY、XShell、SecureCRT、iTerm2)
110+
- **SSH/Telnet** - 终端连接(PuTTY、XShell、SecureCRT、iTerm2、Ghostty
111111
- **RDP** - Windows 服务器的远程桌面协议
112112
- **VNC** - 用于远程桌面访问的虚拟网络计算
113113
- **数据库连接**

docs/plugins/DESIGN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ sequenceDiagram
316316
| Windows | terminal | putty |
317317
| Windows | remotedesktop | mstsc |
318318
| Windows | filetransfer | winscp(可选) |
319-
| macOS | terminal | terminal, iterm |
319+
| macOS | terminal | terminal, iterm, ghostty |
320320
| macOS | remotedesktop | 系统 RDP(open) |
321321
| Linux | terminal | 系统 terminal |
322322
| Linux | remotedesktop | xfreerdp, tigervnc |

go-client/pkg/awaken/awaken_darwin.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,30 @@ func awakenSSHCommand(r *Rouse, cfg *config.AppConfig) (*exec.Cmd, error) {
117117
scriptPath := filepath.Join(currentPath, "Scripts", "iterm2_loader.scpt")
118118
//command = fmt.Sprintf(`%s "%s"`, scriptPath, command)
119119
cmd = exec.Command("osascript", "-s", "h", scriptPath, itermCmd, "0")
120+
} else if appItem.Name == "ghostty" {
121+
// Ghostty has no "do script" AppleEvent; `open -na --args -e` only works
122+
// cleanly on a cold start. Once Ghostty is already running, that path
123+
// triggers a security confirmation and, if allowed, a broken extra tab.
124+
// Its AppleScript dictionary avoids both, cold or warm. "wait after
125+
// command" keeps the surface open once the client exits. "activate"
126+
// runs last since calling it earlier opens Ghostty's own default tab;
127+
// the window-count check picks new tab vs. new window so repeat
128+
// connections land in the existing window instead of a new one.
129+
ghosttyCmd := strings.NewReplacer(`\`, `\\`, `"`, `\"`).Replace(
130+
fmt.Sprintf("%s %s", clientPath, commands),
131+
)
132+
script := fmt.Sprintf(`tell application "Ghostty"
133+
set cfg to new surface configuration
134+
set command of cfg to "%s"
135+
set wait after command of cfg to true
136+
if (count of windows) > 0 then
137+
new tab in (front window) with configuration cfg
138+
else
139+
new window with configuration cfg
140+
end if
141+
activate
142+
end tell`, ghosttyCmd)
143+
cmd = exec.Command("osascript", "-e", script)
120144
} else {
121145
cmd = exec.Command(
122146
"osascript", "-s", "h", "-e", fmt.Sprintf(`tell application "%s" to do script "%s %s" activate`,

plugins/macos/index.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
"name": "dbeaver",
1212
"category": "databases"
1313
},
14+
{
15+
"id": "macos.ghostty",
16+
"name": "ghostty",
17+
"category": "terminal"
18+
},
1419
{
1520
"id": "macos.iterm",
1621
"name": "iterm",
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"platform": "macos",
3+
"match_first": [],
4+
"is_default": false,
5+
"is_set": false,
6+
"is_internal": true,
7+
"executable": {
8+
"type": "bundled",
9+
"default": "Ghostty"
10+
},
11+
"launch": {
12+
"type": "args",
13+
"template": "{protocol} {username}@{host} -p {port} -P {value}"
14+
},
15+
"display_name": "Ghostty"
16+
}
73.7 KB
Loading
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"id": "macos.ghostty",
3+
"name": "ghostty",
4+
"display_name": "Ghostty",
5+
"version": "1.0.0",
6+
"min_client_version": "4.1.3",
7+
"author": "JumpServer",
8+
"homepage": "https://github.com/jumpserver/clients",
9+
"download_url": "https://ghostty.org/download",
10+
"category": "terminal",
11+
"protocols": [
12+
"ssh",
13+
"telnet"
14+
],
15+
"builtin": true,
16+
"comment": {
17+
"zh": "Ghostty是一款快速、功能丰富、跨平台的终端模拟器。\n\n!!!手动下载安装,点击保存启用!!!",
18+
"en": "Ghostty is a fast, feature-rich, cross-platform terminal emulator.\n\n!!!Manually download and install, click Save to activate!!!"
19+
}
20+
}

ui/assets/images/ghostty.png

73.7 KB
Loading

ui/components/SettingItems/settingItems.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const { setAppConfig } = useSettingManager();
2020
2121
const imagesMap: Record<string, string | undefined> = {
2222
iterm: getImageByName("item2"),
23+
ghostty: getImageByName("ghostty"),
2324
dbeaver: getImageByName("dbeaver"),
2425
heidisql: getImageByName("heidisql"),
2526
mstsc: getImageByName("mstsc"),

0 commit comments

Comments
 (0)