Add a copy-on-select clipboard target option (PRIMARY selection), matching Ghostty's copy-on-select #748
Replies: 4 comments 1 reply
|
+1 to this. I tested a workaround on ArchLinux/Wayland(Hyprland + Ghostty): wl-paste --type text --watch wl-copy --primary This makes Herdr's CLIPBOARD copy available as PRIMARY, and middle-click paste works in normal Wayland apps. However, inside Herdr with So I think there are two related pieces:
The second part matters because Herdr's own pane-aware selection is better than terminal-native selection, so |
|
+1 |
|
@ogulcancelik I see you've since landed Updated proposal Keep
What changed vs. my original proposal
Implementation sketch (I have this working locally on top of current master,
I'm happy to open a PR with this if you approve the direction — and equally happy to adjust the value names or shape to whatever fits herdr's conventions. |
|
Quick update: the proposal above is implemented and up to date on my fork, rebased on current master with https://github.com/martinholy/herdr/tree/copy-on-select-primary Happy to open a PR if the direction gets a go-ahead — and to adjust naming/shape to whatever fits herdr's conventions. |
Uh oh!
There was an error while loading. Please reload this page.
What I'd like
On Linux/X11 and Wayland there are two independent clipboards: the system CLIPBOARD (Ctrl+C / Ctrl+V) and the PRIMARY selection (auto-filled on text selection, pasted with middle-click). Today herdr writes a pane selection to the system clipboard only, so the PRIMARY / middle-click flow doesn't get the selected text.
I'd like a config option that controls which clipboard a pane selection is copied to — modeled directly on Ghostty's
copy-on-select.Prior art: Ghostty's
copy-on-selectGhostty (https://ghostty.org/docs/config/reference#copy-on-select) solves exactly this with one three-valued option. Quoting its semantics so we're matching the real behavior, not my paraphrase:
false— disables copy on select entirely.true— copy on select goes to the selection clipboard (PRIMARY). Not supported on platforms such as macOS. This is Ghostty's default on Linux.clipboard— copy on select goes to both the system clipboard and the selection clipboard (on Linux).Adopting the same option and value names means anyone coming from Ghostty gets the behavior they already expect, and the middle-click flow just works.
Note on default / behavior change
herdr today copies a selection to the system clipboard. Ghostty's
truedefault copies to PRIMARY only. So if herdr matches Ghostty's defaults verbatim, the selection would stop landing on the system clipboard by default — which is a behavior change. A safe alternative is to default herdr toclipboard(both), preserving today's Ctrl+V behavior while adding PRIMARY. I'll defer to your call on the default; flagging it because it's a product-direction decision, not just an implementation detail.Why this matters to me
Middle-click paste is muscle memory in my Linux workflow. With herdr I select text in a pane but can only paste it via the system-clipboard path, which clobbers whatever I had on Ctrl+C and breaks the select-here / middle-click-there flow I use constantly between terminals and the browser. Matching Ghostty's
copy-on-selectfixes this.Rough shape (not a design proposal — open to your direction)
copy-on-select-style option acceptingfalse/true/clipboard(exact key/naming/default entirely your call to fit herdr's config conventions).wl-copy --primary,xclip -selection primary,xsel --primary.truedegrades to / is treated as no selection clipboard there — same constraint Ghostty documents.I'm aware this touches mouse/selection ergonomics, so I'm raising it as a discussion first rather than a PR. Happy to implement it if it fits herdr's direction — just want a product-direction check and a steer on the config shape, naming, and default before writing anything.
Environment
All reactions