Skip to content

Instantly share code, notes, and snippets.

@Jzarecta
Created March 25, 2016 18:23
Show Gist options
  • Save Jzarecta/478b01d4666f4c4cef6a to your computer and use it in GitHub Desktop.
Save Jzarecta/478b01d4666f4c4cef6a to your computer and use it in GitHub Desktop.
Script to sign your clipboard on the go
#!/bin/bash
########################################
### signclipboard ##
### gpg sign your content on the go ##
### by: JZA ##
########################################
# choose your desired keyid
keyid = '7F4C2614'
# Get the clipboard content
if ! tty -s && stdin=$(</dev/stdin) && [[ "$stdin" ]]; then
stdin=$stdin$'\n'$(cat)
qdbus org.kde.klipper /klipper setClipboardContents "$stdin"
exit
fi
content="qdbus org.kde.klipper /klipper getClipboardContents"
sign="gpg -u $keyid --clearsign -a" # choose your Keid
insert="qdbus org.kde.klipper /klipper setClipboardContents"
signedcontent=$($content|$sign)
$insert "$signedcontent"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment