sabrogden / Ditto

Ditto is an extension to the Windows Clipboard. You copy something to the Clipboard and Ditto takes what you copied and stores it in a database to retrieve at a later time.
https://ditto-cp.sourceforge.io/
3.31k stars 186 forks source link

Copy text without adding entry to clipboard history in Ditto? #241

Open chaoscreater opened 2 years ago

chaoscreater commented 2 years ago

I'm looking for a way to copy a text and not have it add to my clipboard history in Ditto. Alternatively, if I copy the text using a special hotkey combination, I want this to be copied text to be temporary and it will auto delete itself from Ditto after X seconds. I do NOT want Ditto to auto remove clipboard history for everything, I only want this for text that are "temporary copied", i.e using a specific hotkey combination. Is this possible?

I've never used Copy Buffer before, but I read the description and tried it out and it doesn't seem to be working as intended? My understanding is that when you do a Copy using Copy Buffer, it will copy the text but not add it to Ditto clipboard.

Things can be copied and pasted without affecting the standard clipboard data.

However, it still adds it to my clipboard and I don't want that.

I'm using the latest Ditto version and latest Windows 10 21H1 build if it helps.

UPDATE: OK, I think I know how Copy Buffer works. It allows you to copy and paste data without affecting what is in your normal CTRL+C and CTRL+V. So it's like a separate clipboard essentially. However, this still adds the copied text into the clipboard history in Ditto, which I don't want.

sabrogden commented 2 years ago

If Ditto would delete clips when they were replaced in the copy buffers would that help you.

So you copy "A" in copy buffer 1, "A" would be saved in Ditto until you copied something else in copy buffer 1, at this time "A" would be deleted from Ditto. "A" needs to be in Ditto while it's in a copy buffer because that is where the data is restored from.

chaoscreater commented 2 years ago

No sorry, that would not help me. I don't always copy stuff to copy buffer 1. Data "A" does not need to be in Ditto at all. When I copy data A, I would usually just do an immediate paste and this doesn't need to be saved in Ditto. That would just be a standard copy & paste.

sabrogden commented 2 years ago

You can disconnect Ditto from the clipboard, right click on the task tray - disconnect from clipboard. Now Ditto will not save any clipboard changes, you can still open and paste from Ditto. There is a task tray menu, ... menu or a global shortcut to save the current clipboard into Ditto.

chaoscreater commented 2 years ago

I understand that, but that's one extra step that I'll need to do whenever I don't want a clip to be saved into Ditto. It's too manual.

Isn't there a way to set a keyboard shortcut in Ditto to make a copy of something, without saving the clip to Ditto?

asmoore82 commented 2 years ago

Perhaps if there were a global keyboard shortcut to toggle connect/disconnect from clipboard...

I have found that there is a quickpaste menu hotkey for this, but it's only active when the quickpaste menu is open. I have my quickpaste set to open on ctrl+~[the key above tab] If I set this "toggle clipboard connection" option to ctrl+z (only active in quickpaste menu) Then this sequence of keys will copy the current selection but have Ditto ignore it and not add it to the history:

  1. ctrl+~ (open quickpaste),
  2. ctrl+z (toggle connection off),
  3. esc (close quickpaste),
  4. ctrl+c (copy normally),
  5. ctrl+~ (open quickpaste),
  6. ctrl+z (toggle connection on),
  7. esc (close quickpaste)

This also assumes that the connection was toggled on to begin with. It would be possible to make a macro to do all 7 steps with 1 hotkey with something like AutoHotKey. If it were possible to have a global hotkey as the toggle option it could be reduced to 3 steps and possibly be more reliable as a macro.

asmoore82 commented 2 years ago

I've gotten this macro to work fairly reliably in AutoHotKey. But again, you have to assume that ctrl+~[the key above tab] is the global hotkey to open Ditto's quickpaste, and assume that ctrl+z is the hotkey to "toggle clipboard connection." This global hotkey macro only toggles the option once and closes quickpaste. You can see the dot go off and on in the Ditto tray icon when it toggles the option (dot ON means it's NOT watching the clipboard). Here I'm mapping it to ctrl+shift+c ...

; AutoHotKey script - Ditto: toggle clipboard connection
; map to ctrl + shift + c
^+c::
SetKeyDelay 200 ; this sequence needs to be slow to allow time for
                ; the Ditto menu to pop open
SendEvent ^`` ; send ctrl + backtick [the key above tab]
              ; the backtick itself is an escape character
              ; so 2 of them here mean 1 literal backtick
SendEvent ^z ; send ctrl + z
SetKeyDelay 10 ; the next sequence needs to be faster
SendEvent {Ctrl up}{Shift up}{Esc} ; we have to manually release the ctrl and shift keys
                                   ; because the user pressed them for this hotkey
                                   ; ctrl + esc is the windows default for open start menu
                                   ; ctrl + shift + esc is task manager
                                   ; we definitely don't want either of those.                           
Return

Since I've gotten this functioning and my work setup already includes Ditto and AutoHotKey anyway I think I'll keep it. I can't think of any reason I would need to hit ctrl+shift+c otherwise. I didn't chose ctrl+z randomly for this either, and also not because it's typically "undo" in the windows world, I chose it because it is "suspend process" in bash shell (unix-like terminal).

webtroter commented 2 years ago

Hi,

I was looking for something similar to that. I am copying password from a browser extension, so excluding the browser is a no go.

So if I could bypass the clipboard history somehow, that would make sure I don't keep passwords in the database.

Is it possible to have a shortcut to "paste and remove from history"? That would allow to copy normally from anywhere, and you would simply need to use the "paste and remove from history" function to remove the password from the database.

Another option I was thinking about, but it needs way much more work, and not only for Ditto. The idea was to have a special type that would indicate that the data should not be saved. Ditto could exclude those from the history. But that doesn't depend only on Ditto.

darkzealot77 commented 1 year ago

Hi, Like webtroter, I will be interested by a shortcut for "paste and remove from history". It will be really usefull when copying password.