feat(macos): add default terminal integration (#818)

* feat(macos): add default terminal integration

* fix(macos): route external opens through the layout pull

Five holes in the LaunchServices path, all on the way from a URL to a tab.

The `ssh:` arm handed the raw URL back to `parse_quick_connect`, which
reads a bare `user@host:port` typed into Quick Connect. Everything a URL
carries past the authority landed in the wrong field: `ssh://h:2200/`
parsed its port as `2200/` and was dropped on the floor, `ssh://h/srv`
became the host `h/srv`, and the percent escapes `url` was added for were
never decoded. Read the authority off the parsed URL instead.

`x-man-page://3/printf` is Apple's sectioned form, and taking the host as
the page name ran `man 3`, which asks the user what page they wanted.
Section and page are now both carried.

A window that is pulling its layout is one `Adopt::IfEmpty` will not adopt
into, so a tab inserted while the pull is out comes back as the whole
workspace — the failure `then_open` already exists to avoid. Both the
script/man path and the SSH path inserted straight into a freshly restored
window, so `then_open` becomes a list of parked requests and carries a
command or an SSH link as well as a folder. A cold `ssh://` link also went
through `open_at` directly, claiming a fresh workspace and leaving the
restored one detached and unannounced; it takes the shared restore now.

`new_tab_running` wrote the command whether or not a tab opened, so a
failed spawn typed a script path and a newline into whatever pane was
focused before — a shell mid-line, or an agent.

Left alone deliberately: an `ssh://` link still connects without a
confirmation, which is a product call rather than a defect.

Claude-Session: https://claude.ai/code/session_01E4EPKzHg1fm9HMmHkUYpER

---------

Co-authored-by: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com>
This commit is contained in:
ayamir
2026-09-09 17:05:58 +08:00
committed by GitHub
co-authored by l0ng-ai
parent e632c0f81b
commit 59dbe83913
14 changed files with 781 additions and 58 deletions
+33
View File
@@ -72,6 +72,39 @@ cat > "$APP/Contents/Info.plist" <<PLIST
<key>CFBundlePackageType</key><string>APPL</string>
<key>NSHighResolutionCapable</key><true/>
<key>NSPrincipalClass</key><string>NSApplication</string>
<!-- LaunchServices has no global default-terminal setting. These declare
the specific document types tty7 can open, and Settings lets users
select tty7 as their handler for them. -->
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key><string>Folder</string>
<key>CFBundleTypeRole</key><string>Editor</string>
<key>LSHandlerRank</key><string>Alternate</string>
<key>LSItemContentTypes</key><array><string>public.directory</string></array>
</dict>
<dict>
<key>CFBundleTypeName</key><string>Shell Script</string>
<key>CFBundleTypeRole</key><string>Shell</string>
<key>LSItemContentTypes</key><array><string>public.shell-script</string></array>
</dict>
<dict>
<key>CFBundleTypeName</key><string>Unix Executable</string>
<key>CFBundleTypeRole</key><string>Shell</string>
<key>LSItemContentTypes</key><array><string>public.unix-executable</string></array>
</dict>
</array>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key><string>SSH</string>
<key>CFBundleURLSchemes</key><array><string>ssh</string></array>
</dict>
<dict>
<key>CFBundleURLName</key><string>Man Page</string>
<key>CFBundleURLSchemes</key><array><string>x-man-page</string></array>
</dict>
</array>
<!-- tty7 is a terminal workbench: panes are forked from the bundled
executable, so macOS attributes a child process's protected-resource
requests to tty7.app. Without these usage strings a program you run in