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

copy-on-select = clipboard causes "Copied to clipboard" toast spam #4800

Open
mitchellh opened this issue Jan 8, 2025 · 15 comments · May be fixed by #5995
Open

copy-on-select = clipboard causes "Copied to clipboard" toast spam #4800

mitchellh opened this issue Jan 8, 2025 · 15 comments · May be fixed by #5995
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)

Comments

@mitchellh
Copy link
Contributor

Discussed in #4766

Originally posted by dumbasPL January 7, 2025
host: Arch Linux, GNOME 47 on Wayland
version: 1.0.2-main+a3837a1e (built from source)
simplified config (without theming):

shell-integration-features = no-cursor
copy-on-select = clipboard
scrollback-limit = 134217728
adw-toolbar-style = raised-border
auto-update = off
term = xterm-256color

steps to reproduce:

  1. enable copy-on-select = clipboard
  2. select something by clicking and dragging the mouse
  3. observe Copied to clipboard spam at the bottom

expected behavior:
Copied to clipboard shows once the selection has ended (when the mouse button is lifted)

Solution

I think we should also look into the core here (src/Surface.zig) to see if we should only apply the selection when a mouse release event happens.

We should probably also change the GTK implementation to only show the toast after a very short (50ms or so) delay.

@lcx
Copy link

lcx commented Jan 8, 2025

this happens with MacOS as well, it's constantly copying to clipboard. When using something like alfred which has an option to merge clipboards if cmd+c is pressed twice, the result is very bizzare merging of multiple entries to the clipboard.
Turning this of in alfred still shows the multiple entries of the same data copied to clipboard in the clipboard history.

@gegoune
Copy link

gegoune commented Jan 8, 2025

I have enquired about this a while ago on discord. See link below for screenshot of what's described by @lcx above.

https://discord.com/channels/1005603569187160125/1313506853765779528

@JeffreyVdb
Copy link

This also means that when you're using a clipboard manager, the list of entries is going to get cluttered very quickly. A selection of 10 characters basically means that you'll have 10 entries in your clipboard manager, every subsequent entry being one character longer than the one preceding it. Your last entry will be the one you want but you'll quickly erase other clipboard entries unless your history is really big.

@otomist
Copy link
Contributor

otomist commented Jan 12, 2025

Going to take a shot at fixing this

@otomist
Copy link
Contributor

otomist commented Jan 12, 2025

I think we should also look into the core here (src/Surface.zig) to see if we should only apply the selection when a mouse release event happens.

For mouse release there's functionality for following links. Is it safe to assume that following links should take precedence?
Having both happen works too but my general thought is if someone is holding Ctrl they are probably looking to click a link and not copy text.

@jnichols0
Copy link
Contributor

jnichols0 commented Jan 13, 2025

I've opened PR #5010 to fix the toast spam. @otomist sorry, didn't see you were looking at this til just now. If my implementation turns out to not be quite right, please feel free to take this on. :)

@mitchellh mitchellh added this to the 1.1.0 milestone Jan 23, 2025
@mitchellh
Copy link
Contributor Author

Pushing this out into 1.1.x since the fix requires a bit more work.

@mitchellh mitchellh modified the milestones: 1.1.0, 1.1.1 Jan 29, 2025
@desdic
Copy link

desdic commented Jan 31, 2025

can the 'Copied to clipboard' be disabled completely ? I don't use Gnome but it still blocks the selected text for about 1-2s

@threddast
Copy link

threddast commented Jan 31, 2025

I would also appreciate having an option to disable it, it does look out-of-place on non-Gnome

@mitchellh
Copy link
Contributor Author

Yes you can: https://ghostty.org/docs/config/reference#app-notifications

@mitchellh mitchellh removed this from the 1.1.1 milestone Feb 3, 2025
@erhhung
Copy link

erhhung commented Feb 5, 2025

Coming from iTerm I rely on having the copy-on-select feature. I also use the handy Maccy clipboard utiliity on macOS that, like Alfred, keeps a list of copy buffers.

For a while, I thought I had mechanical mouse button glitches that would quickly obliterate half of my 50-entry Maccy history with near identical entries, then eventually figuring out that the clipboard events are generated each time the selection changes even while the mouse button was still held down.

This should be an easy thing to fix, no? Just trigger the copy event only on mouse up.

@pluiedev pluiedev changed the title GTK: copy-on-select = clipboard causes "Copied to clipboard" toast spam copy-on-select = clipboard causes "Copied to clipboard" toast spam Feb 12, 2025
@pluiedev pluiedev added contributor friendly A well-scoped, approachable issue for someone looking to contributor. gui GUI or app issue regardless of platform (i.e. Swift, GTK) and removed os/linux labels Feb 12, 2025
@pluiedev
Copy link
Member

Unmarking as Linux-specific since this exists on macOS as well

@unknown unknown linked a pull request Feb 26, 2025 that will close this issue
@m-kru
Copy link

m-kru commented Feb 26, 2025

Any updates on this annoying "Copied to clipboard" spam?

@pluiedev
Copy link
Member

Any updates on this annoying "Copied to clipboard" spam?

There's many linked PRs to this issue (e.g. #5995). As a matter of etiquette, please do not leave "any updates" or +1-style comments on issues in this repository.

@ciro-mota
Copy link

app-notifications = no-clipboard-copy - It did what I needed, which is just disabling this notification.

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)
Projects
None yet
Development

Successfully merging a pull request may close this issue.