git.slaskete.net
/
einar-bin
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
62175bf
)
Improved clipboard function
author
Einar Jørgen Haraldseid
<einar@haraldseid.net>
Sat, 27 May 2017 10:32:31 +0000
(12:32 +0200)
committer
Einar Jørgen Haraldseid
<einar@haraldseid.net>
Sat, 27 May 2017 10:32:31 +0000
(12:32 +0200)
screenshot.sh
patch
|
blob
|
history
diff --git
a/screenshot.sh
b/screenshot.sh
index 56ccf5bcf9f73a52d48535580bd64a2870198851..ec1931b80ee1db39c262f5d64d7636960fc74521 100755
(executable)
--- a/
screenshot.sh
+++ b/
screenshot.sh
@@
-21,7
+21,13
@@
function errcho() {
function take_screenshot() {
FileName="$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 6 | head -n 1).png"
if [ "$@" = "clipboard" ]; then
function take_screenshot() {
FileName="$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 6 | head -n 1).png"
if [ "$@" = "clipboard" ]; then
- xclip -out -selection clipboard -t image/png > "${LocalPath}/${FileName}" 2>/dev/null
+ xclip -out -selection clipboard -t image/png > "/tmp/${FileName}" 2>/dev/null
+ if [ "$(file -b --mime-type /tmp/${FileName})" == "image/png" ]; then
+ mv "/tmp/${FileName}" "${LocalPath}/"
+ else
+ rm "/tmp/${FileName}"
+ notify-send -i applets-screenshooter "screenshot.sh" "Tried to post image from clipboard, but found no image there."
+ fi
else
gnome-screenshot -f "${LocalPath}/${FileName}" -p "$@"
fi
else
gnome-screenshot -f "${LocalPath}/${FileName}" -p "$@"
fi