dotfiles/dot_local/scripts/executable_screenshot.sh

20 lines
517 B
Bash

#!/bin/bash
set -e
SCREENSHOT=$HOME/.cargo/bin/leanshot
# choose some file to save it to
FILENAME="$(date +%Y-%m-%d-%H:%M:%S).png"
FILE="$HOME/Screenshots/$FILENAME"
$SCREENSHOT $1 -o $FILE
# copy to clipboard
XCLIP=/usr/bin/xclip
$XCLIP -selection clipboard -t image/png -i $FILE
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"