dotfiles/dot_local/scripts/executable_screenshot.sh

21 lines
517 B
Bash
Raw Normal View History

2020-04-09 04:18:20 +00:00
#!/bin/bash
2020-07-13 09:56:26 +00:00
set -e
2020-04-09 04:18:20 +00:00
SCREENSHOT=$HOME/.cargo/bin/leanshot
# choose some file to save it to
2020-07-13 09:56:26 +00:00
FILENAME="$(date +%Y-%m-%d-%H:%M:%S).png"
FILE="$HOME/Screenshots/$FILENAME"
2020-04-09 04:18:20 +00:00
$SCREENSHOT $1 -o $FILE
2020-07-13 09:56:26 +00:00
# copy to clipboard
2020-04-09 04:18:20 +00:00
XCLIP=/usr/bin/xclip
$XCLIP -selection clipboard -t image/png -i $FILE
2020-07-13 09:56:26 +00:00
notify-send "captured $FILENAME"
# upload it
url=$(ssh -vv -i $HOME/.ssh/id_rsa homelab $HOME/.local/bin/file-upload $FILENAME < $FILE 2> log)
url=${url%$'\n'}
$XCLIP -selection clipboard <<< "$url"
notify-send "uploaded $FILENAME"