CopyQ icon indicating copy to clipboard operation
CopyQ copied to clipboard

“Paste & Delete” hotkey (Paste item and remove it from history)

Open aaa1386 opened this issue 1 month ago • 3 comments

I’d like to request a new feature for CopyQ: a special type of paste action that automatically deletes the pasted item from the clipboard history.

Use case

Sometimes I copy a text, paste it somewhere, and I know I will never need it again. But CopyQ keeps that item in the history and I need to delete it manually.

Suggested solution

Add a new configurable shortcut or command such as:

  • Shift + V → Paste the current item and immediately remove it from the history.
  • Or when selecting an item in the CopyQ window, use Ctrl + Enter to paste the selected item and automatically delete it afterward.

Why it’s useful

  • Keeps clipboard history clean
  • Faster workflow
  • Saves time by avoiding manual deletion
  • Optional behavior triggered only by dedicated shortcut

Thank you!

aaa1386 avatar Nov 17 '25 07:11 aaa1386

I’d like to request a new feature (or command) in CopyQ that behaves similarly to Cut in text editors.

Use case

Sometimes I select multiple items in CopyQ and press Ctrl+C to copy them and paste elsewhere. However, I no longer need those items afterwards, but CopyQ keeps them in the history unless I manually remove them.

Proposed solution

Add a dedicated command or shortcut such as:

  • Ctrl+X → Copy all selected items to the clipboard → Immediately remove the selected items from history

This would provide a “Copy & Delete” workflow identical to a Cut operation, but for multi-item selections in CopyQ.

Why this matters

  • Saves time
  • Prevents clutter in clipboard history
  • Matches user expectations (like Ctrl+X behavior in editors)
  • Works especially well when using CopyQ as a temporary collection/inbox

Thanks!

aaa1386 avatar Nov 17 '25 07:11 aaa1386

Hello, you can already do this with a command. This is very similar to the template Hluk provides with the paste and forget command: https://github.com/hluk/copyq-commands/blob/master/commands/paste-and-forget.ini

Here is an example command you can make and tie to a global shortcut: This will paste your last copied item from your open tab in CopyQ, then copy blank, and remove this item from your tab. The scripting for making your own command sis very powerful: https://copyq.readthedocs.io/en/latest/scripting-api.html#remove

copyq: tab(selectedtab()) items = selecteditems() if (items.length > 1) { text = '' for (i in items) text += read(items[i]); copy(text) } else { select(items[0]) }

hide() sleep(100) paste() sleep(1000) copy('') remove(0)

Snowy556 avatar Nov 17 '25 23:11 Snowy556

Thank you very much.

copyq:
// تشخیص ترتیب REAL انتخاب کاربر
var sel = ItemSelection().current();
if (sel.length === 0) {
    exit();
}

// گرفتن ترتیب واقعی از ItemSelection
var texts = [];
for (var i = 0; i < sel.length; i++) {
    var item = sel.itemAtIndex(i);
    texts.push(str(item[mimeText]));
}

var finalText = texts.join('\n');

// پیست
copy(finalText);
hide();
sleep(300);
paste();
sleep(1000);

// حذف
sel.removeAll();

I modified the code you provided so that when multiple items are selected from the list, it can delete all of them after pasting. But there is one problem I couldn’t solve:

When I select several items from the list, the order in which I selected them is not recognized when pasting.

For example, suppose my list contains:

1111
2222
3333

If I select the three items in this order: first 2222, then 1111, and then 3333, the selected order is not preserved after pasting.

aaa1386 avatar Nov 18 '25 05:11 aaa1386

When I select several items from the list, the order in which I selected them is not recognized when pasting.

Ah, this was fixed just recently. See #3273.

The fix will be available in the next release.

hluk avatar Dec 18 '25 16:12 hluk