hluk / CopyQ

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

Custom command to hide passwords under notes does not work in 8.0.0 #2725

Open setedivento opened 1 month ago

setedivento commented 1 month ago

Context what I need to do is to make CopyQ, when the main window is displayed, hide the text of those clipboard items that have an associated note – provided they are placed under a specific tab. Let's say the tab is called "auths" and I have all my stored passwords in there: what I want to achieve is being able to copy the passwords as regular text as usual, but to hide them when, suppose, I have to share the screen during work-calls.

Bug description I have created a custom command to achieve what I want, and that has always worked in past versions of CopyQ: while now, whether you install the same version of CopyQ (8.0.0) on Windows 10 or Windows 11, it doesn't make a difference, and it works only in a particular case, but not the main desidered one. The command's script is conceived to work in Display mode, so it only affects how copy items are shown, and not their clipboard content when they are copy-pasted.

To look at the script's details, please refer to the following images. 1 script code 2 script cfg

To Reproduce please add a new Command with this code:

copyq:
var notes = str(data(mimeItemNotes))
if (notes) {
  setData(mimeText, "")
}

and configure the Advanced options like in the image above, creating a new tab and setting it as the target of the Command. Now in the dedicated tab you have created, add a new copy item, and then add a note to that: let's call this item "item with a note".

Expected behavior The item with a note, when the main window of the program in activated, should display the note text only, and not its original source text; but then when the item is pasted, CopyQ should paste the source text as usual.

Screenshots this is the result of the Command when the main program window is dispayed and it works notes_working this is the result of the Command when the main program window is dispayed and it doesn't work notes_not_working

Version, OS and Environment

Additional notes the Command works when you modify the notes of an item; but the change is not persistent, and all the items return to their previous state when one exits and opens the program again.

Thanks so much for fixing this!