dotfiles/private_dot_local/bin/executable_scr

37 lines
804 B
Bash

#!/bin/sh
SHAREX_URL="changeme";
SHAREX_TOKEN="changeme";
upscale="no";
upload="no";
if [ "$1" = "-U" ]; then shift
upscale="yes";
fi
if [ "$1" = "-upload" ]; then shift
upload="yes";
fi
name=$(date +"scrot_%Y.%m.%d_%H.%M.%S.png");
out_path="$HOME/images/shots/$name";
# scrot -z -b "$@" "$name" || exit;
maim "$@" --hidecursor --capturebackground "$name" -l -c "0.3,0.4,0.6,0.4" || exit $?;
if [ "$upscale" = "yes" ]; then
convert "$name" -scale "200%" PNG24:"$out_path";
else
cp "$name" "$out_path";
fi;
rm "$name";
xclip -sel c -i "$out_path" -t 'image/png';
notify-send "screenshot" "$out_path"
if [ "$upload" = "yes" ]; then
curl -H "Content-Type: multipart/form-data" \
-H "authorization: $SHAREX_TOKEN" \
-F "file=@$out_path" \
"$SHAREX_URL";
fi