Skip to content
AzYuJiePublic

About

Right-click enhancement for macOS Finder — new file, open terminal, copy path (macOS 13+)

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

Repository files navigation

zen-right

macOS Finder 右键增强 · Right-click enhancement for macOS Finder

新建文件 · 打开终端 · 复制路径

功能 · 构建安装 · 架构 · 路线图 · English


为什么有 zen-right

在 Windows 上「右键新建文件」是理所当然的事,macOS Finder 至今没有。想在当前目录弹个终端、把路径粘进聊天窗口,也要点好几层。zen-right 把这三件高频小事放回右键菜单里——原生菜单、零弹窗、不打断。

自用优先(dogfooding)项目:作者每天在用,遇到什么修什么。

✨ 功能

功能 说明
新建文件 20+ 格式:骨架类(txt / Markdown / JSON / Shell / Python / Swift …)+ 二进制(docx / xlsx / pptx)。重名自动编号,可选创建后自动进入重命名
打开终端 9 款终端按需选择:Terminal / iTerm2 / Warp / Alacritty / kitty / WezTerm / Hyper / Tabby / Ghostty。对文件右键打开其所在目录;仅列出本机已安装的终端,装新自动识别
复制路径 5 种格式:绝对路径 / Shell 转义 / file:// URI / ~ 缩写 / 仅文件名。多选合并复制,格式跟随最近使用

菜单随选择场景自动适配:空白处、单文件、多选、文件夹各不相同。深浅色主题下图标双轨染色(青瓷绿 / 亮青瓷)。

📸 界面

Finder 右键菜单 右键菜单(另一场景)
右键菜单 右键菜单

设置窗(新建文件/终端/路径/通用四区)

设置窗:四区即改即生效,变更实时推送到 Finder 扩展(无需重启)

🔧 构建安装

没有 Apple 开发者账号,不做公证分发——请从源码构建(约两分钟):

# 依赖:macOS 13+ / Xcode 16+(XcodeGen 会自动生成工程)
brew install xcodegen

git clone https://github.com/AzYuJie/zen-right.git
cd zen-right
./scripts/dev-install.sh          # 构建 → 安装到 /Applications → 注册扩展 → 启动

安装后首次启动会弹引导,按提示在 系统设置 → 登录项与扩展 → 访达 中启用扩展即可。

日常开发循环同样一条命令:./scripts/dev-install.sh(增量构建 + 自动清理 LaunchServices 残留)。

🏗 架构一瞥

Finder 扩展(沙盒内,薄壳)          宿主 App(菜单栏常驻)
┌────────────────────────┐  DCN 无载荷信号  ┌────────────────────────┐
│ 菜单规划 MenuPlanner    │ ←──────────────→ │ SettingsCenter 快照推送 │
│ 点击 → NSMenuItem.tag   │  DropBox 文件交接 │ ActionCenter 动作执行  │
└────────────────────────┘ ──── action ────→ │ 新建文件/终端/复制路径  │
                                           └────────────────────────┘
  • Thin extension:扩展只做菜单渲染与点击移交,全部执行在宿主——Finder 卡死零风险
  • 双通道通信:macOS 沙盒下 DistributedNotificationCenter 带 payload 会被静默丢弃,故控制面走无载荷信号、数据面走双方容器内文件交接(DropBox 模式),这是实机排障得出的结论,详见 docs/tad.md
  • 纯函数菜单规划:MenuPlanner 输入快照+场景输出菜单树,56 个单测全绿
  • Swift 6 严格并发(宿主 / SharedKit),扩展 target Swift 5 模式(FIFinderSync ObjC 回调边界)

🗺 路线图

  • E1–E3:工程骨架 / 菜单与点击链路 / 三大功能执行器
  • E4:设置窗四区 · 首启引导 · 菜单栏状态 · 品牌图标双轨
  • E4 剩余:模板管理 UI
  • E5:zh-Hans String Catalog · 自定义模板 · 两周自用验收

🤝 贡献

自用优先、随缘维护。Issue 欢迎,PR 前请先开 Issue 讨论。

📄 许可

MIT


禅圆 · 一笔而起,右键即达


English

zen-right — Right-click enhancement for macOS Finder

New File · Open Terminal · Copy Path

Features · Build & Install · Architecture · 中文

Why

"Right-click → New File" is a given on Windows; macOS Finder still lacks it in the 2020s. Opening a terminal in the current directory or pasting a path into a chat takes too many clicks. zen-right puts these three frequent actions back into the context menu — native menu, zero popups, zero interruption.

Dogfooding first: the author uses it daily and fixes what breaks.

Features

Feature Details
New File 20+ formats: skeletons (txt / Markdown / JSON / Shell / Python / Swift …) + binary (docx / xlsx / pptx). Auto numbering on name collision, optional auto-rename after creation
Open Terminal 9 terminals: Terminal / iTerm2 / Warp / Alacritty / kitty / WezTerm / Hyper / Tabby / Ghostty. Right-clicking a file opens its directory; only installed terminals are listed, auto-detected on install
Copy Path 5 formats: absolute / shell-quoted / file:// URI / ~ abbreviation / filename only. Multi-selection merges into one clipboard, format follows most-recent use

The menu adapts to context: empty area, single file, multi-selection, folders. Icons are dual-track tinted (celadon / bright celadon) for light/dark themes.

Screenshots

Context menu Context menu (another scenario)
Context menu Context menu

Settings window (4 panes)

Settings: changes take effect instantly — pushed to the Finder extension without restart

Build & Install

No Apple developer account, no notarized builds — build from source (~2 min):

# Requires: macOS 13+ / Xcode 16+ (XcodeGen generates the project)
brew install xcodegen

git clone https://github.com/AzYuJie/zen-right.git
cd zen-right
./scripts/dev-install.sh          # build → /Applications → register → launch

On first launch, follow the onboarding to enable the extension in System Settings → Login Items & Extensions → Finder.

The same one-liner drives the dev loop (incremental build + LaunchServices residue cleanup).

Architecture at a glance

Finder extension (sandboxed, thin)        Host app (menu bar resident)
┌────────────────────────┐  payload-free  ┌────────────────────────┐
│ MenuPlanner (pure fn)   │ ←── DCN ─────→ │ SettingsCenter pushes  │
│ click → NSMenuItem.tag  │  DropBox files │ ActionCenter executes  │
└────────────────────────┘ ─── action ───→ │ file/terminal/path     │
                                           └────────────────────────┘
  • Thin extension: the extension only renders the menu and hands off clicks; all execution happens in the host — zero risk of hanging Finder
  • Dual-channel IPC: under macOS sandboxing, DistributedNotificationCenter payloads are silently dropped, so the control plane uses payload-free signals and the data plane uses file handoff in both containers (DropBox pattern) — a conclusion from on-device debugging, see docs/tad.md
  • Pure-function menu planning: MenuPlanner maps (snapshot, context) → menu tree, 56 unit tests green
  • Swift 6 strict concurrency (host / SharedKit); extension target in Swift 5 mode (FIFinderSync ObjC callback boundary)

Roadmap

  • E1–E3: project skeleton / menu & click pipeline / action executors
  • E4: 4-pane settings · onboarding · menu-bar status · dual-track brand icons
  • E4 remaining: template manager UI
  • E5: zh-Hans String Catalog · custom templates · two-week dogfood acceptance

Contributing

Dogfooding first, maintained as time allows. Issues welcome; please open an Issue before a PR.

License

MIT


Ensō · one stroke, one right-click

About

Right-click enhancement for macOS Finder — new file, open terminal, copy path (macOS 13+)

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages