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

Various behavior changes that work better for me #7

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

josephlbarnett
Copy link

@josephlbarnett josephlbarnett commented Feb 22, 2024

Only paste on middle button press
ie, ignore side buttons like forward/back

Also don't paste unless the cursor is an ibeam,
aka is hovering over a text field. Should let the
middle button work for eg browser links in new tab
hopefully

Only copy on drag if we've dragged more than 5 px away
Prevent spurious copys on click while moving the mouse slightly

Don't copy on double click
Only copy when dragging to highlight, to make the
highlight -> double click -> paste use case more
useful

Copy on triple click
Instead of copy on double click, do copy on triple click because
that's unlikely to be followed by an immediate paste, but does
highlight eg browser url bar which is usually worth a copy.

Manage a separate paste buffer for middle click
When we copy, save the current clipboard prior to copying,
then when we notice the clipboard change, store that clipboard
in a separate pasteItems and restore the old clipboard. When we
paste via middle button, set the clipboard to the stored pasteItems,
and when we can set the clipboard back to the saved current clipboard.
Because of that, restore copy-on-double-click behavior, as the typical
patterns work well with a separate clipboard and selection buffer.
There's still a little bit of a race if you select/paste too fast though?

ie, ignore side buttons like forward/back
Don't paste unless the cursor is an ibeam,
aka is hovering over a text field.  Should let the
middle button work for eg browser links in new tab
hopefully
@insign
Copy link

insign commented Feb 28, 2024

Not sure but the repo looks zombie. I would like to follow more in your own repo. Keep us updated.

@insign
Copy link

insign commented Feb 28, 2024

Working fine to me. Thank you. Sonoma M2

@insign
Copy link

insign commented Feb 28, 2024

To use with my macbook trackpad I use it together with https://github.com/artginzburg/MiddleClick-Sonoma

@insign
Copy link

insign commented Feb 29, 2024

Can you run the copy action when there is text to copy? The Force Touch is running all the time with nothing to copy 😢

@insign
Copy link

insign commented Feb 29, 2024

Of course, if possible using its own clipboard would make it a masterpiece because sometimes as dev I copy something and select another to delete then paste. But I paste exactly what I deleted. 🫠

@josephlbarnett
Copy link
Author

not sure what you mean about Force Touch, but certainly possible i messed something up with that last commit. i see the copy working pretty much how I want it to at this point, but could be missing something.

the paste what i want to overwrite problem is a bad one for sure, not sure if something like flycut running in conjunction with this would be a decent solution?

@insign
Copy link

insign commented Feb 29, 2024

I just want to disable the copy on force click at trackpad, IDK why but when I force click (real click on trackpad) it acts like middle click....

@insign
Copy link

insign commented Mar 1, 2024

UPDATE: I pulled your last update from this PR and now it pastes twice 😭

Prevent spurious copys on click while moving the mouse slightly
Only copy when dragging to highlight, to make the
highlight -> double click -> paste use case more
useful
@josephlbarnett josephlbarnett changed the title Only paste on middle button press Various behavior changes that work better for me Mar 5, 2024
Instead of copy on double click, do copy on triple click because
that's unlikely to be followed by an immediate paste, but does
highlight eg browser url bar which is usually worth a copy.
@insign
Copy link

insign commented Mar 7, 2024

Why triple click is important if double will already select?

@josephlbarnett
Copy link
Author

its my attempt to avoid the "as dev I copy something and select another to delete then paste. But I paste exactly what I deleted" problem -- I usually double click to select a variable to paste over, so don't want that double click to copy. but my browser does a triple click to select the full URL, so do want that to copy. YMMV

When we copy, save the current clipboard prior to copying,
then when we notice the clipboard change, store that clipboard
in a separate pasteItems and restore the old clipboard.  When we
paste via middle button, set the clipboard to the stored pasteItems,
and when we can set the clipboard back to the saved current clipboard.

Because of that, restore copy-on-double-click behavior, as the typical
patterns work well with a separate clipboard and selection buffer.
There's still a little bit of a race if you select/paste too fast though?
@insign
Copy link

insign commented Mar 21, 2024

I’m not the owner but thank you for this great changes. By not messing with the main clipboard is such an amazing change. Ever.

@insign
Copy link

insign commented Mar 26, 2024

Just tested, not sure if I understood but the clipboard keeps the same, one single buffer :/
MY ERROR: not checked out only-center-button-press branch.

For now looks amazing!

@insign
Copy link

insign commented Mar 26, 2024

@josephlbarnett I usually take screenshots with main button (right click drag then release) but are being blocked by the macpaste, so the image does not go to the clipboard, keeps the previous text.

@insign
Copy link

insign commented Mar 28, 2024

After two days I need to say that this is almost stable, thanks again!

@josephlbarnett
Copy link
Author

haha yes, almost stable indeed -- seems like some amount of highlight, pause and move mouse, command+c copy, pause and move mouse, ok go ahead and work normal works most of the time, but the race condition there is a little maddening. not sure about the screenshot workflow or if I can do anything to avoid the blockage (at this point it shouldn't affect any right clicks, just left and middle clicks).

@insign
Copy link

insign commented Apr 1, 2024

@josephlbarnett the problem is not about taking screenshots itself but the act of click drag to the area then drop. The macpaste probably understands as a selection drag and drop.

I think this works better?  Possibly seeing some
times when a double click followed by a copy doesn't
fill the regular clipboard, but mostly works?  Have to
live with it a little longer to tell...
@serapch
Copy link

serapch commented Aug 1, 2024

@josephlbarnett Great work, I'm using your fork and I'm super pleased with the behaviour. It's sad that project is stale and this couldn't reach broader audience.

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

Successfully merging this pull request may close these issues.

3 participants