From 1ce349ec5cbef3ca3426f8927a2bb91d21cccae9 Mon Sep 17 00:00:00 2001 From: Seaswimmer Date: Sun, 9 Jun 2024 16:31:42 -0400 Subject: [PATCH] Add zipline/flameshot.sh --- zipline/flameshot.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 zipline/flameshot.sh diff --git a/zipline/flameshot.sh b/zipline/flameshot.sh new file mode 100644 index 0000000..efc3b6a --- /dev/null +++ b/zipline/flameshot.sh @@ -0,0 +1,14 @@ +#!/bin/bash +flameshot gui -r > /tmp/ss.png +[ ! -s /tmp/ss.png ] && exit 1 + +temp_file=$(mktemp) +trap 'rm -f "$temp_file"' EXIT + +# Replace TOKEN and ZIPLINE_URL with your authorization token and the url to your Zipline instance before use, nothing else needs modified +if curl -sS -fH "authorization: TOKEN" https://ZIPLINE_URL/api/upload -F file=@/tmp/ss.png -H "Content-Type: multipart/form-data" >"$temp_file" 2>&1; then + jq -r '.files[0]' <"$temp_file" | tr -d '\n' | xsel -ib + notify-send -a "Flameshot" -u low -h "string:desktop-entry:org.flameshot.Flameshot" "Upload Successful" "Link copied to clipboard" +else + notify-send -a "Flameshot" -u critical -h "string:desktop-entry:org.flameshot.Flameshot" "Upload Failed" "$(<"$temp_file")" +fi