Last active
November 9, 2025 06:40
-
-
Save hluk/c64f91454c6983fb5433 to your computer and use it in GitHub Desktop.
CopyQ 2.3.0 user commands to move items to trash and undo the removal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Commands] | |
| 1\Name=Move to Trash (Undoable) | |
| 1\Command=" | |
| copyq: | |
| trash_tab = \"(trash)\" | |
| tab_mime = \"application/x-copyq-user-tab\" | |
| index_mime = \"application/x-copyq-user-index\" | |
| time_mime = \"application/x-copyq-user-time\" | |
| time = (new Date).toISOString() | |
| source_tab = selectedtab() | |
| tab(source_tab) | |
| items = selecteditems() | |
| if (source_tab != trash_tab) { | |
| for (i in items) { | |
| item = getitem(items[i]) | |
| item[tab_mime] = source_tab | |
| item[index_mime] = items[i] | |
| item[time_mime] = time | |
| tab(trash_tab) | |
| setitem(i, item) | |
| tab(source_tab) | |
| } | |
| } | |
| remove.apply(this, items)" | |
| 1\InMenu=true | |
| 1\Icon=\xf014 | |
| 1\Shortcut=Del | |
| 2\Name=Undo Delete | |
| 2\Command=" | |
| copyq: | |
| trash_tab = \"(trash)\" | |
| tab_mime = \"application/x-copyq-user-tab\" | |
| index_mime = \"application/x-copyq-user-index\" | |
| time_mime = \"application/x-copyq-user-time\" | |
| remove_mime = [tab_mime, index_mime, time_mime] | |
| tab(trash_tab) | |
| item = getitem(0) | |
| time = str(item[time_mime]) | |
| select_items = [] | |
| remove_items = [] | |
| target_tab = str(item[tab_mime]) | |
| while (true) { | |
| index = item[index_mime] | |
| for (i in remove_mime) | |
| delete item[remove_mime[i]] | |
| tab(target_tab ? target_tab : selectedtab()) | |
| setitem(index, item) | |
| select_items.push(index) | |
| var i = remove_items.length | |
| remove_items.push(i) | |
| tab(trash_tab) | |
| item = getitem(i + 1) | |
| if ( !time || time !== str(item[time_mime]) ) | |
| break; | |
| } | |
| if (target_tab) | |
| show(target_tab) | |
| tab(selectedtab()) | |
| selectitems.apply(this, select_items) | |
| tab(trash_tab) | |
| remove.apply(this, remove_items)" | |
| 2\InMenu=true | |
| 2\Icon=\xf112 | |
| 2\Shortcut=Ctrl+Z | |
| size=2 |
Author
Exception in "Undo Delete"
Invalid number of arguments!
Command "Undo Delete"
Exit code: 4
1. copyq
2. trash_tab = "trash"
3.
4. tab.mime = "application/x-copyq-user-tab"
5. index_mime = "application/x-copyq-user-index"
6. time
- CopyQ 13.0.0
- OS: Microsoft Windows 10.0.26200.7019
- Installation method:
https://github.com/hluk/CopyQ/releases/download/v13.0.0/copyq-13.0.0.zip
Author
This command is obsolete. Please use the one in copyq-commands repo: Undoable Move to Trash
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Moved to copyq-commands repository.