Can now display desktop message. Now you know when accidental picture uploads happen.

This commit is contained in:
Jon Michael Aanes 2017-10-20 18:01:10 +02:00
parent 2a2d4f1f09
commit 84371c963a

View File

@ -18,16 +18,24 @@ else
scrot -u $TEMP_FILE scrot -u $TEMP_FILE
end end
set LINK (echo (sha256sum -b $TEMP_FILE) | xxd -r -p | base64 | cut -c-3) # We generate a unique id, by hashing, hexduming, turning that into
# base64 with '_' instead of '/', and only taking the first 3
# characters.
set LINK (sha256sum -b $TEMP_FILE | xxd -r -p | base64 | sed -e "s:/:_:g" | cut -c-3)
set FILENAME $LINK$FILE_EXT set FILENAME $LINK$FILE_EXT
if count $argv > /dev/null if count $argv > /dev/null
set LINK $FILENAME set LINK $FILENAME
end end
function display_message
notify-send $argv
end
if test $TEMP_FILE if test $TEMP_FILE
echo $HTTP_URL$LINK | xclip -i -sel clip echo $HTTP_URL$LINK | xclip -i -sel clip
display_message "Screenshot taken. File accessable at '$HTTP_URL$LINK'"
#
scp $TEMP_FILE "$SCP_USER@$SCP_HOST:$SCP_PATH/$FILENAME" scp $TEMP_FILE "$SCP_USER@$SCP_HOST:$SCP_PATH/$FILENAME"
rm $TEMP_FILE rm $TEMP_FILE
echo "File accessable at '$HTTP_URL$LINK'"
end end