ghostty icon indicating copy to clipboard operation
ghostty copied to clipboard

macos: add proxy icon hover mode and disabled state

Open MoonMao42 opened this issue 7 months ago • 4 comments

Implements #5919.

Extends macos-titlebar-proxy-icon to three values:

  • visible — always show the proxy icon (old default)
  • hidden — show on hover via NSTrackingArea on the titlebar (new default)
  • disabled — never show, also disables drag-drop and cmd-click path menu

The hover tracking uses NSTrackingArea with .mouseEnteredAndExited on TerminalWindow.titlebarContainer. A cached currentPwdURL is kept separate from representedURL so switching from disabled back to visible/hidden restores the icon without waiting for the next cd.

Config changes apply immediately to open windows through GhosttyConfigDidChange.

Here's what the hover mode looks like: proxy-icon

AI Usage

Used Claude Opus via Claude Code (GSD workflow) for initial config scaffolding. Swift/AppKit hover implementation written by hand. Codex used for review pass. I understand all the code.

MoonMao42 avatar Apr 07 '26 15:04 MoonMao42

Always-visible is actually legacy macOS behavior from before Monterey. Since macOS 12 the system default has been hover-to-show — Finder, Xcode, etc. all do this now. Terminal.app still shows it permanently but that's more of a "hasn't been updated" thing than a deliberate choice.

The mapping from old to new: visible = same as before, always show. hidden = hover to show (what macOS does by default since Monterey). disabled = what hidden used to be, completely off.

Defaulting to hidden just matches what the OS does. But if you'd rather not change the default I can keep it at visible, no strong feelings.

MoonMao42 avatar Apr 07 '26 15:04 MoonMao42

Always-visible is actually legacy macOS behavior from before Monterey. Since macOS 12 the system default has been hover-to-show — Finder, Xcode, etc. all do this now. Terminal.app still shows it permanently but that's more of a "hasn't been updated" thing than a deliberate choice.

The mapping from old to new: visible = same as before, always show. hidden = hover to show (what macOS does by default since Monterey). disabled = what hidden used to be, completely off.

Defaulting to hidden just matches what the OS does. But if you'd rather not change the default I can keep it at visible, no strong feelings.

This is true when there is a toolbar, as I commented in the discussion. So I would suggest adding an empty toolbar to hidden (hover to show), and removing it otherwise. This would match the system's default behaviour, without the hassle of adding a tracking area ourselves, but titlebarTextField and titlebarContainer may need some tweaks as well, depending on whether there is a toolbar or not.

let toolbar = NSToolbar(identifier: "TerminalToolbar")
self.toolbar = toolbar
toolbarStyle = .unifiedCompact

bo2themax avatar Apr 08 '26 08:04 bo2themax

@jcollie What do you think?

MoonMao42 avatar Apr 15 '26 12:04 MoonMao42

@jcollie What do you think?

I'm not really a macOS dev so I'll leave the review to others.

jcollie avatar Apr 15 '26 14:04 jcollie