hluk / copyq-commands

Useful commands for CopyQ clipboard manager.
328 stars 72 forks source link

Remove trailing space #85

Closed kayanco closed 8 months ago

kayanco commented 8 months ago

Hi,

CopyQ is now working perfect for me; it's the best tool! I just have one issue:

Is there any way to auto remove trailing space when copy/pasting: For example, "copyq " would be pasted as "copyq" (without the ending space)

Would really appreciate it!

hluk commented 8 months ago

The following command removes spaces from beginning and end of a newly copied string (not from existing items in the app):

[Command]
Automatic=true
Command="
    copyq:
    const text = str(input())
    const newText = text.trim()
    if (newText != text) {
        copy(newText)
        setData(mimeText, text)
        removeData(mimeHtml)
    }"
Icon=\xf0c4
Input=text/plain
Match=^\\s|\\s$
Name=Trim Whitespace