Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Robert Labudda
utils
Commits
7f012fdc
Commit
7f012fdc
authored
Dec 06, 2018
by
Robert Labudda
Browse files
init
parents
Changes
2
Hide whitespace changes
Inline
Side-by-side
gpgclip.sh
0 → 100755
View file @
7f012fdc
#!/bin/bash
#
# You can run this script to execute gpg command on the content of your clipboard.
#
CMD
=
"
$1
"
clipbin
=
$(
which xclip 2> /dev/null
)
notifybin
=
$(
which notify-send 2> /dev/null
)
zenitybin
=
$(
which zenity 2> /dev/null
)
gpgbin
=
$(
which gpg2 2> /dev/null
)
if
[
-z
"
$clipbin
"
]
then
echo
"Could not find the program xclip."
exit
-1
fi
if
[
-z
"
$notifybin
"
]
then
echo
"Could not find the program notify-send from libnotify."
exit
-1
fi
if
[
-z
"
$zenitybin
"
]
then
echo
"Could not find the program zenity."
exit
-1
fi
if
[
-z
"
$gpgbin
"
]
then
echo
"Could not find the program gpg2."
exit
-1
fi
if
[
-z
"
$CMD
"
]
then
echo
"No operation"
echo
"Your options are: verify, sign, or decrypt"
exit
-2
fi
if
[
"
$CMD
"
=
"verify"
]
then
output
=
$(
$clipbin
-selection
clipboard
-o
|
$gpgbin
--verify
2>&1
)
echo
"
$output
"
|
$zenitybin
--text-info
--title
=
"Signature verification"
--width
=
800
--height
=
500
--font
=
monospace
elif
[
"
$CMD
"
=
"sign"
]
then
output
=
$(
$clipbin
-selection
clipboard
-o
|
$gpgbin
--clear-sign
)
if
[
"
$?
"
-eq
0
]
then
echo
"
$output
"
|
$clipbin
-selection
clipboard
-i
$notifybin
-i
"info"
"Text signed"
else
$notifybin
-i
"error"
"Signing failed or cancelled"
fi
elif
[
"
$CMD
"
=
"decrypt"
]
then
output
=
$(
$clipbin
-selection
clipboard
-o
|
$gpgbin
-d
2>&1
)
echo
"
$output
"
|
$zenitybin
--text-info
--title
=
"Decrypted message"
--width
=
800
--height
=
500
--font
=
monospace
fi
exit
0
qrclip
0 → 100755
View file @
7f012fdc
#!/bin/bash
# Display the content of the selection as a QR code
#
# Requires xclip, qrencode, and display from ImageMagick
xclip
-o
| qrencode
-o
- | display
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment