Skip to content

Instantly share code, notes, and snippets.

@Rmlyy
Last active March 24, 2022 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rmlyy/3d712dd1d5ed75416746f7657b3819fb to your computer and use it in GitHub Desktop.
Save Rmlyy/3d712dd1d5ed75416746f7657b3819fb to your computer and use it in GitHub Desktop.
Flameshot upload script
#!/bin/bash
# Base: https://github.com/notmeta/flameshot-s3-uploader
url="url"
key="secretkey"
temp_file="/tmp/screenshot.png"
flameshot gui -r > $temp_file
if [[ $(file --mime-type -b $temp_file) != "image/png" ]]; then
rm -rf $temp_file
notify-send "Screenshot aborted" -a "Flameshot" && exit 1
fi
image_url=$(curl -s -F file=@$temp_file "$url?key=$key&onlyURL=1")
echo -n $image_url | xclip -sel c
notify-send "Image URL copied to clipboard" "$image_url" -a "Flameshot" -i $temp_file
rm -rf $temp_file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment