This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Cipboard Actions - Process Base64 String

Tags: cipboard, actions, base64 cipboard, actions, base64 cipboard, actions, base64
(comma "," separated)
acwhiteman
Registered Member
Posts
3
Karma
0
OS
Hi all,

I posted this issue in Stackoverflow and Askubuntu without takers. It occurred to me that this was the most relevant place to ask this question.

I would like to add an 'Action' in the KDE Plasma clipboard to decode a base64 string. So the procedure would be something like this:
    1) Highlight and copy a Base64 string into the clipboard
    2) Select the item in the clipboard and choose 'Action'
    3) Select the 'Base64' action
    4) The string gets processed and the result gets copied as a new item in the clipboard

This was my attempt:

In KDE Plasma (Linux Mint 18), the clipboard widget allows each item to be edited, and a command executed using a regex. First, I manually marked a base64 text string with a '{' bracket, to ensure that no other strings get identified by the clipboard.

{QGStMW4xdnykZnRv


Then I created a clipboard 'Action' that uses a regex to exclude the bracket and process the rest of the string:

[^{].*$


This seems to work well to select everything but the bracket from the base64 string:

QGStMW4xdnykZnRv


Next, I tried adding either of the following commands (which tested fine in the console):

echo %s | base64 --decode


openssl enc -base64 -d <<< %s


The Plasma Clipboard widget uses the '%s' in a command to place the clipboard contents.

When editing the command within the Clipboard Action, one of the options is "Output Handling" which I set to "Add to Clipboard". Therefore it is expected that the output of the base64 command should be placed as a new item on the clipboard. However, this is NOT working.

Any insight to solving this will be greatly appreciated.


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], q.ignora, watchstar