screenshot/screenshot.sh at master · Carlgo11/screenshot
2021-11-23 17:24:39 Author: github.com(查看原文) 阅读量:3 收藏

Permalink

Cannot retrieve contributors at this time

#!/bin/bash
upload_url=https://api.tempfiles.download/upload/
screenshot_path=~/Pictures/Screenshots
screenshot_name="screenshot_$(date +%s).png"
remove=false
error() {
notify-send "$1"
exit 1
}
[[ -d "$screenshot_path" ]] || mkdir "$screenshot_path"
full_path="$screenshot_path/$screenshot_name"
[[ "$1" == "window" ]] && import -window root "$full_path" || import "$full_path"
[[ "$1" == "local" ]] && notify-send "Screenshot saved!"; exit 0
data=$(curl -s -X "POST" -F "[email protected]$full_path" "$upload_url")
if [ -f "$full_path" ]; then
[[ "$remove" == true ]] && rm "$full_path"
else
error "Error creating screenshot."
fi
[[ -n "$data" ]] && url=$(echo "$data" | jq -r .url) || error "No response from TempFiles"
echo "$url" | xclip -selection clipboard
notify-send "Screenshot URL copied!"
exit 0

文章来源: https://github.com/Carlgo11/screenshot/blob/master/screenshot.sh
如有侵权请联系:admin#unsafe.sh