Open cmd+clicked terminal links in cmux browser panel (#53)
* Open cmd+clicked terminal links in cmux browser panel instead of system browser Handle GHOSTTY_ACTION_OPEN_URL in the Ghostty action callback to intercept link opens. Uses preferredBrowserTargetPane to reuse an existing right-side pane, falling back to a new horizontal split. * Use tab-specific manager for OPEN_URL action Use tabManagerFor(tabId:) instead of the active-window tabManager so the lookup succeeds when the surface belongs to a different window context.
This commit is contained in:
parent
14ce05db5f
commit
7f8b639ae3
2 changed files with 23 additions and 0 deletions
|
|
@ -888,6 +888,25 @@ class GhosttyApp {
|
|||
surfaceView.updateKeyTable(action.action.key_table)
|
||||
return true
|
||||
}
|
||||
case GHOSTTY_ACTION_OPEN_URL:
|
||||
let openUrl = action.action.open_url
|
||||
guard let cstr = openUrl.url else { return false }
|
||||
let urlString = String(cString: cstr)
|
||||
guard let url = URL(string: urlString) else { return false }
|
||||
guard let tabId = surfaceView.tabId,
|
||||
let surfaceId = surfaceView.terminalSurface?.id else { return false }
|
||||
return performOnMain {
|
||||
guard let app = AppDelegate.shared,
|
||||
let tabManager = app.tabManagerFor(tabId: tabId) ?? app.tabManager,
|
||||
let workspace = tabManager.tabs.first(where: { $0.id == tabId }) else {
|
||||
return false
|
||||
}
|
||||
if let targetPane = workspace.preferredBrowserTargetPane(fromPanelId: surfaceId) {
|
||||
return workspace.newBrowserSurface(inPane: targetPane, url: url, focus: true) != nil
|
||||
} else {
|
||||
return workspace.newBrowserSplit(from: surfaceId, orientation: .horizontal, url: url) != nil
|
||||
}
|
||||
}
|
||||
default:
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
4
TODO.md
4
TODO.md
|
|
@ -47,6 +47,10 @@
|
|||
- [ ] Add question mark icon to learn shortcuts
|
||||
- [ ] Notification popover: each button item should show outline outside when focused/hovered
|
||||
- [ ] Notification popover: add right-click context menu to mark as read/unread
|
||||
- [ ] Cmd+click should open links in cmux (browser panel) instead of external browser
|
||||
- [ ] "Waiting for input" notification should include custom terminal title if set
|
||||
- [ ] Close button for current/active tab should always be visible (not just on hover)
|
||||
- [ ] Add browser icon to the left of the plus button in the tab bar
|
||||
|
||||
## Analytics
|
||||
- [x] Add PostHog tracking (set `PostHogAnalytics.apiKey` in `Sources/PostHogAnalytics.swift`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue