hluk / CopyQ

Clipboard manager with advanced features
GNU General Public License v3.0
8.63k stars 440 forks source link

action to past the Nth entry directly #2284

Closed jmlucjav closed 1 year ago

jmlucjav commented 1 year ago

Is your feature request related to a problem? Please describe. Hi, I have moved to CopyQ from ditto, and this is working very well. The only thing I miss dearly is this feature in ditto:

  1. you can define global hotkeys to paste entry Nth, so for instance you can have C-1 will paste 1st entry, C-2 2nd etc, I had them up to 5
  2. you typically use this a lot when you need to copy several different pieces of text into new places, you just copy all of them and then go and paste them by just moving where you need to and doing C-5, move C-4...

Describe the solution you'd like Something like this in CopyQ would be great

Describe alternatives you've considered By looking at https://github.com/hluk/CopyQ/issues/1948 I guess this is totally doable, in fact it sound like it should be even simpler than this? But I have not tried to implement it myself, I have no idea where to start

Additional context Just wanted to raise this in case someone has already implemented this. I see a bunch of people from from ditto, so it is not crazy thinking that someone might already created something similar...

thanks a lot!

hluk commented 1 year ago

See: https://github.com/hluk/copyq-commands/tree/master/Global#paste-nth-item (see README.md for details on how to add the command)

jmlucjav commented 1 year ago

this is wonderful!! Thank you! I hope this will bring joy to many more ditto users....

I noticed the paste does not happen until you release the Ctrl key, but not big deal, I will get used to it.

One question though, I could not find it in the docs...where are the commands stored? Does not look its in the ini files no?

hluk commented 1 year ago

I noticed the paste does not happen until you release the Ctrl key, but not big deal, I will get used to it.

CopyQ waits for modifier keys to be released so it can safely send paste shortcut to the target app. This is the most reliable way to paste I have found.

One question though, I could not find it in the docs...where are the commands stored? Does not look its in the ini files no?

The commands are stored in %APPDATA%\copyq\copyq-commands.ini (for the portable version it is under copyq folder). See also: https://copyq.readthedocs.io/en/latest/faq.html#where-to-find-saved-items-and-configuration

jmlucjav commented 1 year ago

I have been using this since it was provided, it is working nicely, thank you very much. There is one thing that would make it perfect though, would it be possible somehow to modify the code https://github.com/hluk/copyq-commands/blob/master/Global/paste-nminus1th-item.ini so the Nth item just copied this way is not moved to the top (when you have this configuration enabled)?

The issue is, if you copy 5 items, and start pasting them C-5, C-4...As soon as you paste the first, the rest are moved down etc, so you need to do some mental math to calculate where is the next one now etc. Would be much simpler if when pasting this way, they are not moved.

thank you

hluk commented 1 year ago

would it be possible somehow to modify the code https://github.com/hluk/copyq-commands/blob/master/Global/paste-nminus1th-item.ini so the Nth item just copied this way is not moved to the top

Change select(n-1) to copy(mimeItems, read(mimeItems, n-1)) in the command to just copy the item instead.

jmlucjav commented 1 year ago

Excelllent news yet again, works like a charm, thanks!