I have found no way to tell klipper to apply the action automatically. The most what klipper does automatically is to pop up a menu with the actions. It will take another mouse click to actually apply the action.
The Automatic
checkbox in the action properties dialog has the following effect: if you copy a text, and the text matches a configured regular expression, then a menu with the corresponding actions pops up. Note that Enable Clipboard Actions
must be enabled for this. If either Enable Clipboard Actions
or Automatic
is disabled, then no menu will appear upon a copy.
For alternatives: I looked around and found no clipboard manager which does what you want (match regex, modify clipboard content automatically). I tested some clipboard managers which offer similar functionality to klipper. They all do not apply the actions automatically, instead, they offer a popup menu for the configured action, just like klipper.
It seems you will have to code your own solution.
A naive implementation might look like this:
- Monitor content of clipboard.
- If content changes, match against regex.
- If regex matches, modify content of clipboard.
It should be possible to code that using, for example, python and PyGTK or PyQt.
Alternatively you can hack up a shell script using the command xclip -o
to dump the content of the clipboard, and xclip -i
to insert the modified content into the clipboard.
I found a project that seems to have implemented point number 1 and some of number 2 using perl and the xclip
command: https://github.com/trapd00r/clipbored. Maybe you can start form there and modify it to suit your needs.
2Thanks for the pointer to
xclip
; that makes writing something to do what I need dead simple. – Patches – 2011-05-26T08:54:15.837