Handle libghostty's action callbacks: open_url, cursor shapes, link hover, secure input, bell, titles - #194
Open
thdxg wants to merge 2 commits into
Open
Handle libghostty's action callbacks: open_url, cursor shapes, link hover, secure input, bell, titles#194thdxg wants to merge 2 commits into
thdxg wants to merge 2 commits into
Conversation
write_scrollback_file:open and friends worked only through the core's error-logged 'open -t' fallback; opening the payload ourselves matches Ghostty.app (text kind opens in the default text editor, schemeless strings are file paths per ghostty#8763).
Macterm answered false to most action callbacks, so several terminal features users configure in ghostty silently did nothing: - MOUSE_SHAPE / MOUSE_VISIBILITY: the pointer now follows libghostty (I-beam over text, pointing hand over links, resize arrows for TUI drags, hide-while-typing), applied via the scroll view's documentCursor like Ghostty's own mac app. - MOUSE_OVER_LINK: hovering a link shows a Safari-style URL banner in the pane's bottom-left corner. - SECURE_INPUT: a new SecureInput manager (ported from Ghostty.app) shields keystrokes during password prompts and the toggle_secure_input keybind, with a per-pane lock badge gated by macos-secure-input-indication; balancing logic is unit-tested via injected hooks. - RING_BELL: bell-features support (system beep, custom audio, dock attention). - OPEN_CONFIG / CHECK_FOR_UPDATES: open the user's ghostty config in their editor (creating it if missing) and run a Sparkle check. - SET_TAB_TITLE / PROMPT_TITLE / COPY_TITLE_TO_CLIPBOARD: mapped onto Macterm's tab customTitle, the sidebar rename flow, and the pane's display title. - RENDERER_HEALTH: logged, so a black pane is diagnosable. The default case now documents why the rest stay unhandled (Macterm- owned window/tab/split management, GTK/iOS-only actions, sizing hints, COLOR_CHANGE, SHOW_CHILD_EXITED relying on the core overlay).
Contributor
Window-state benchmark
Reported value is the median of 3×10s windows per state (splitting the window and taking the median keeps one co-scheduled spike from skewing a state); CPU % is the process CPU-time delta over a window. Runs land on different shared runners, so treat small deltas as noise — 🔺/🔻 marks changes ≥25% that also clear the metric's absolute noise floor (CPU % ≥0.5, Memory (RSS MB) ≥25, CPU ms/s ≥5, Wakeups/s ≥50); CPU deltas off a noise-dominated baseline aren't flagged (CPU % baseline ≥1.5, CPU ms/s baseline ≥15). The |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Macterm's action callback (
GhosttyCallbacks.action) answeredfalseto ~50 of libghostty's ~64 action tags. Most are deliberate (Macterm owns window/tab/split management), but a batch of real terminal features silently did nothing. This PR fills every gap that has a sensible Macterm behavior:OPEN_URLwrite_scrollback_file:open& friends open natively (text → default text editor, matching Ghostty.app) instead of through the core's error-loggedopen -tfallbackMOUSE_SHAPEdocumentCursor(same mechanism as Ghostty's mac app)MOUSE_VISIBILITYNSCursor.setHiddenUntilMouseMovesMOUSE_OVER_LINKSECURE_INPUTSecureInputmanager (ported from Ghostty.app): shields keystrokes during password prompts (macos-auto-secure-input) and thetoggle_secure_inputkeybind; focus-scoped, released on app deactivation, balanced enable/disable; per-pane lock badge gated bymacos-secure-input-indicationRING_BELLbell-features: system beep, custombell-audio-pathsound, dock attentionOPEN_CONFIGCHECK_FOR_UPDATESSET_TAB_TITLEcustomTitle(empty restores the automatic title)PROMPT_TITLECOPY_TITLE_TO_CLIPBOARDRENDERER_HEALTHThe
default:case now documents why the remainder stay unhandled: Macterm-owned window/tab/split actions (a ghosttykeybind = cmd+t=new_tabis ignored by design), GTK/iOS-only tags, sizing hints that don't map onto one shared window of splits,UNDO/REDO(no app-level undo stack),COLOR_CHANGE(chrome follows the resolved theme viaCONFIG_CHANGE), andSHOW_CHILD_EXITED(returning false is what makes the core render its abnormal-exit overlay — the error UI remote projects rely on).Quick-terminal note
Tab-title actions are wired through an optional
AppStateenvironment; the quick terminal's hosting view has noAppState(and no tab UI), so those no-op there while cursor/link/secure-input/bell all still work.Testing
SecureInputbalancing via injected hooks (global/scoped/focus/inactive/failure), cursor-shape mapping,renameTab(containing:)/setTabTitle(containing:),resolvedOpenTargetURL-vs-path. Full suite green.write_scrollback_file:openwrites and opens the scrollback file with no "apprt did not handle open URL action" warning;open_configopens the config file;toggle_secure_inputflows through scope add/remove (the OS flip is correctly withheld while the app is inactive);set_tab_titleshows up intab list.🤖 Generated with Claude Code