Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS: support selection pasteboard #2722

Closed
mitchellh opened this issue Nov 18, 2024 · 0 comments · Fixed by #4733
Closed

macOS: support selection pasteboard #2722

mitchellh opened this issue Nov 18, 2024 · 0 comments · Fixed by #4733
Labels
contributor friendly A well-scoped, approachable issue for someone looking to contributor. gui GUI or app issue regardless of platform (i.e. Swift, GTK) os/macos
Milestone

Comments

@mitchellh
Copy link
Contributor

Discussed in #2670

Originally posted by lilyball November 13, 2024
One of my favorite Terminal.app features is it has a menuitem ⇧⌘V for Paste Selection. What this does is whatever the last text I selected in Terminal.app was, it pastes that. So this is kind of like copy-on-select behavior except it stores it in a separate pasteboard and only pasted when I use the Paste Selection action. This can be used across windows too, and it's also persisted across relaunch. I'd really love to see Ghostty pick up the same feature.

Implementation note: my initial guess here is Terminal.app uses +[NSPasteboard pasteboardWithName:] to create a private pasteboard for this purpose, which would also explain how it persists it (since I don't see it writing the string to preferences). I don't know what name it's using for this. If Ghostty does this as a macOS-only feature then it could perhaps do the same thing.

I believe we should be able to implement this already since we support a selection pasteboard on Linux. I think this is probably almost purely a Swift thing, maybe some embedded apprt work but not much.

@mitchellh mitchellh added os/macos contributor friendly A well-scoped, approachable issue for someone looking to contributor. gui GUI or app issue regardless of platform (i.e. Swift, GTK) labels Nov 18, 2024
mitchellh added a commit that referenced this issue Jan 8, 2025
As discussed in #2670 and #2722

- This uses an NSPasteboard with the name
`com.mitchellh.ghostty.selection` as a dedicated 'selection' clipboard
- Sets `supports_selection_clipboard` to true for macOS
- Sets the default `copy-on-select` config to `.true` for macOS
- Adds a "Paste Selection" menu item and default cmd+shift+v key binding
for macOS (to match Terminal.app)
@github-actions github-actions bot added this to the 1.1.0 milestone Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor friendly A well-scoped, approachable issue for someone looking to contributor. gui GUI or app issue regardless of platform (i.e. Swift, GTK) os/macos
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant