From 56997e6bc3ff5fc6d658dae0fbb16334bdf75f9b Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 2 Oct 2016 19:29:13 +1100 Subject: [PATCH] initial support --- neofetch | 52 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/neofetch b/neofetch index ddfe3cda..1482af9f 100755 --- a/neofetch +++ b/neofetch @@ -2218,10 +2218,6 @@ getimage() { img="$thumbnail_dir/$imgname" } -takescrot() { - $scrot_cmd "${scrot_dir}${scrot_name}" -} - # }}} # Find w3m-img {{{ @@ -2290,6 +2286,54 @@ getimagebackend() { # }}} +# Screenshot {{{ + +takescrot() { + $scrot_cmd "${scrot_dir}${scrot_name}" +} + +# }}} + +# Screenshot Upload {{{ + +image_host="imgur" + +scrot_upload() { + image_file="${scrot_dir}${scrot_name}" + + case "$image_host" in + "teknik") + baseurl='https://u.teknik.io' + uploadurl='https://api.teknik.io/upload/post' + ret="$(curl -sf -F file="@${image_file}" ${uploadurl})" + desturl="${ret##*url\":\"}" + desturl="${desturl%%\"*}" + desturl="${desturl//\\}" + ;; + + "mediacrush") + baseurl='https://mediacru.sh' + uploadurl='https://mediacru.sh/api/upload/file' + ret="$(curl -sf -F file="@${image_file};type=image/png" ${uploadurl})" + filehash=$(echo "${ret}" | grep "hash" | cut -d '"' -f4) + desturl="${baseurl}/${filehash}" + ;; + + "imgur") + baseurl='http://imgur.com' + uploadurl='http://imgur.com/upload' + ret="$(curl -sf -F file="@${image_file}" ${uploadurl})" + filehash="${ret##*hash\":\"}" + filehash="${filehash%%\"*}" + desturl="${baseurl}/${filehash}" + ;; + esac + + printf "%s\n" "your screenshot can be viewed at $desturl" +} + +# }}} + # }}} # Text Formatting {{{