Pintaste Pintaste

OpenInOtty: Open the current directory in Otty with one click from the Finder toolbar

2 min read 480 words 阅读中文版

Summary

OpenInOtty is a minimal macOS Finder toolbar app: click the icon to open an Otty terminal in the current Finder path. If Otty is already running, it opens a new tab; if not, it launches Otty and navigates to the directory. MIT licensed, single-file Swift implementation.

OpenInOtty is a minimal macOS Finder toolbar app: click the toolbar icon in Finder and it opens a terminal in the current directory using Otty.

Repository: github.com/pintaste/OpenInOtty (MIT). Inspired by OpenInTerminal-Lite.

What problem does it solve?

When writing code or tweaking configs on a daily basis, you often find yourself already in a folder in Finder, only to open a terminal and cd your way back to the same path. Otty is a great terminal, but there’s no native way to jump straight from Finder into Otty with one click.

OpenInOtty reduces that to a single icon on the toolbar:

  • Click → grab the current Finder window path
  • Otty is already running → use otty-cli tab new --cwd <path> to open a new tab
  • Otty is not running → use otty-cli open <path> to launch and enter the directory
  • No Finder window available → fall back to the Desktop
  • On failure, show an NSAlert — no silent swallowing of errors

The app uses LSUIElement: no Dock icon, no persistent menu bar. Click once, send the command, and exit — no background footprint.

Requirements

Dependency Version / Notes
macOS 12.0 Monterey or later
Xcode 15+ (the free App Store version is fine)
Otty Installed at the default path
/Applications/Otty.app

Installation

  1. Clone and build the Release target:

git clone https://github.com/pintaste/OpenInOtty.git
cd OpenInOtty
xcodebuild -project OpenInOtty.xcodeproj \
           -scheme OpenInOtty \
           -configuration Release \
           -derivedDataPath build \
           build
cp -R build/Build/Products/Release/OpenInOtty.app /Applications/
  1. Hold ⌘ and drag /Applications/OpenInOtty.app to the Finder toolbar.
  2. On the first click, macOS will ask for Apple Events / Automation permissions — choose Allow .

If you accidentally declined, you can reset permissions and try again:


tccutil reset AppleEvents com.local.OpenInOtty

You can also check in System Settings: Privacy & Security → Automation (OpenInOtty → Finder).

How it works (simplified)

The implementation is concentrated in a single main.swift (roughly one hundred lines), with no AppDelegate and no persistent event loop:

  1. Use ScriptingBridge to read the frontmost Finder window’s path ( finderPath() )
  2. Check whether Otty (bundle ID io.appmakes.otty ) is running
  3. Call /Applications/Otty.app/Contents/MacOS/otty-cli to open a tab or launch
  4. Show an error dialog on failure; on success, immediately exit(0)

Quick reference for AI agents

Item Value
Bundle ID com.local.OpenInOtty
Install path /Applications/OpenInOtty.app
Otty path /Applications/Otty.app
Otty CLI .../Contents/MacOS/otty-cli
UI type LSUIElement = true

⌘ dragging to the toolbar must be done by the user; agents should not fabricate bundle IDs or Otty paths.

FAQ

Clicking does nothing?

Make sure Otty is at /Applications/Otty.app, and check Automation permissions. If the permission entry is missing, use the tccutil reset reset above and try again.

Opens the Desktop instead of the current folder?

You need at least one non-minimized Finder window; minimized windows are not treated as the current directory.

Summary

If you use Otty daily and like browsing project folders in Finder, OpenInOtty condenses “navigate → terminal” into a single toolbar click. Short source code, no background process, MIT open source.

CC BY-NC-SA 4.0 · pintaste

Comments

Giscus comments activate once PUBLIC_GISCUS_* env vars are set.