https://bugs.kde.org/show_bug.cgi?id=185311

htpha <ht...@gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ht...@gmx.net

--- Comment #5 from htpha <ht...@gmx.net> ---
(In reply to Mike from comment #4)
> Currently I manage this with a script that runs from .config/autostart and
> checks org.kde.klipper.klipper.getClipboardContents once per minute. Then,
> when extant data in the clipboard is unchanged for >10 minutes, it runs
> clearClipboardHistory.
> 
> A more perfect (for me) solution would watch for clipboard activity (copy
> AND paste), then clear the contents if there is no activity for x seconds.

Hi!
I might have a solution/workaround for you :^)

I was working on a solution to open mpv on copying youtube urls. I am using
Klippers Action Menu for this to pass all urls matching my pattern to mpv but
this will clutter Klipper with youtube links after a while. Therefore I wanted
these Klipper entries to be removed on triggering my Klipper action. If you
suppress the output of your command or your command doesn't write to stdout and
select "Replace current clipboard" for "Output from command:" this entry will
be removed from Klippers list.

So here is something you can try:

1. Create a new Klipper Action: Configure Clipboard > Actions Configuration >
Add Action
2. Action Properties: Enter your regex pattern and description, ie. "Clear
clipboard history in ... secs after this copy" > Add Command
3. Command Properties: Command: sleep $YOUR_X_SECS && qdbus org.kde.klipper
/klipper org.kde.klipper.klipper.clearClipboardHistory
4. Command Properties: Output from command: Replace current clipboard (if you
want this specific entry to be deleted instead of whole history)
4. ??
5. Profit

With this you have control over when the history should be cleared instead of
relying on a timer. In my case only entries I want to be removed will be
affected and everything else stays. I don't use any delay, only surpressing
mpv's output is enough. You can do something similar for anything you don't
want to stay in the history. Name the Action something like "Delete this in
10secs" and as Command only use sleep.

I also ticked "Show action popup menu:" to "Immediately on selection" or you
can press your shortcut to trigger the Action menu. I believe Meta+Ctrl+R is
the default.

At n...@kde.org: what is the purpose of
org.kde.klipper.klipper.clearClipboardContents? It doesn't seem to do
anything..

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to