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

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

Open
mitchellh opened this issue Jan 8, 2025 · 6 comments
Open
Labels

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
Collaborator

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

otomist commented Jan 12, 2025

Going to take a shot at fixing this

@otomist
Copy link

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. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants