Skip to content
godlockinPublic

About

🍎 在 Finder 里右键直达终端 — 自动检测 iTerm2/Terminal/Warp/Ghostty/kitty 等

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

go2shell logo

go2shell

在 Finder 里右键,直达终端。

build platform license

右键文件夹 → 服务 ▸ go2shell → 在该目录打开终端窗口。

自动检测已安装的终端:iTerm2 · Terminal · Warp · Ghostty · Alacritty · kitty · WezTerm

usage diagram

示意图(非实机截图)

安装

需要 macOS 13+ 与 Xcode Command Line Tools(xcode-select --install)。

# 一行安装(clone + 编译 + 安装 + 注册右键服务 + 弹出引导窗口)
curl -fsSL https://raw.githubusercontent.com/godlockin/go2shell/miao/install.sh | zsh -s -- --with-services

或手动:

git clone https://github.com/godlockin/go2shell.git && cd go2shell
zsh install.sh --with-services

安装后:

  • CLI:~/Library/Application Support/go2shell/go2shell
  • App(含 Finder 扩展与引导窗口):/Applications/Go2Shell.app
  • 右键服务:go2shell(右键文件夹)与 go2shell · 此处(菜单栏/快捷键)
  • 新服务已通过 pbs -read_bundle 显式注册并自动重启 Finder,右键即用

卸载:zsh uninstall.sh

onboarding window

使用

场景 操作
右键某个文件夹 服务 ▸ go2shell → 默认终端在该目录开新窗口
多选文件夹 同上,每个文件夹各开一窗
空白处(无「服务」项,macOS 限制) 给 go2shell · 此处 设快捷键:系统设置 → 键盘 → 键盘快捷键 → 服务(如 ⌃⌥T),在 Finder 里按热键即在当前窗口目录开终端

切换默认终端(iTerm2 优先为默认):

~/Library/Application Support/go2shell/go2shell config default terminal
~/Library/Application Support/go2shell/go2shell list   # 查看已安装终端

引导窗口(安装后自动弹出,也可随时打开 Go2Shell.app)里同样可以选默认终端。

CLI 完整用法

go2shell                          # Finder 当前目录 + 默认终端
go2shell open [-t <id>] [path]    # 指定终端/路径; path 为文件时取父目录
go2shell list                     # 列出已安装终端
go2shell path                     # 打印将使用的目标目录
go2shell config default <id>      # 设默认终端

终端启动策略

id 名称 方式
iterm2 iTerm2 AppleScript 建新窗口 + write text "cd"
terminal Terminal open -a Terminal <dir>
warp Warp open -a Warp <dir>
ghostty Ghostty open -n -a Ghostty --args --working-directory
alacritty Alacritty open -n -a Alacritty --args --working-directory
kitty kitty open -n -a kitty --args --directory
wezterm WezTerm open -n -a WezTerm --args start --cwd

进阶:Finder 扩展(go2shell ▸ 子菜单形态)

仓库内含 FinderSync 扩展(Go2Shell.app 内嵌 .appex):右键目录或空白处出现 go2shell ▸ 子菜单,hover 展开、实时列出已安装终端(带 app 图标)、点哪个用哪个 —— 即 macOS 限制下空白处右键的最佳形态。

启用:系统设置 → 通用 → 登录项与扩展 → 找到 go2shell → 勾选 Finder 开关 → 重启 Finder。

⚠ macOS 26 (Tahoe) 的 pluginkit 对手工 ad-hoc 签名的 FinderSync 扩展会静默不注册(pluginkit -m 无记录)。若系统设置扩展列表看不到 go2shell,说明被此策略拦截,用上面的服务/快捷键方案即可;用开发者证书正式签名可解。

开发

纯 swiftc 手工构建,无需 Xcode 工程:

zsh build.sh     # 双架构编译 CLI + app + appex + ad-hoc 签名
zsh install.sh --with-services
zsh test.sh      # headless 回归
src/Terminals.swift    终端注册表 + 检测 + 启动策略 (CLI/扩展/服务共用)
src/FinderPath.swift   Finder 选区/窗口路径解析
src/main.swift         CLI 入口
ext/FinderSync.swift   FinderSync 扩展: 右键实时构建终端子菜单
ext/main.swift         appex 入口 (NSExtensionMain)
app/main.swift         父应用: 引导窗口 (选默认终端) + --screenshot 自渲染
scripts/gen_icon.swift 图标/Logo 生成 (CoreGraphics)
scripts/gen_diagram.swift README 示意图生成

CI(GitHub Actions,macos-15 runner)在每次 push 时自动编译双架构产物并上传 artifact;打 v* tag 自动发布 Release。

License

MIT

About

🍎 在 Finder 里右键直达终端 — 自动检测 iTerm2/Terminal/Warp/Ghostty/kitty 等

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages