file upload screenshots

This commit is contained in:
Michael Zhang 2020-07-13 04:56:26 -05:00
parent cab46024db
commit c43147e79b
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
2 changed files with 15 additions and 2 deletions

View file

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

View file

@ -18,6 +18,7 @@ export RUST_SRC_PATH="$(rustc --print sysroot)/lib/rustlib/src/rust/src"
export EDITOR=nvim export EDITOR=nvim
source $HOME/.cargo/env source $HOME/.cargo/env
source $HOME/.ghcup/env
export PATH="$HOME/.local/bin:$HOME/.local/scripts:$HOME/.dotnet/tools:$PATH:$HOME/go/bin" export PATH="$HOME/.local/bin:$HOME/.local/scripts:$HOME/.dotnet/tools:$PATH:$HOME/go/bin"
[ -f "${GHCUP_INSTALL_BASE_PREFIX:=$HOME}/.ghcup/env" ] && source "${GHCUP_INSTALL_BASE_PREFIX:=$HOME}/.ghcup/env" [ -f "${GHCUP_INSTALL_BASE_PREFIX:=$HOME}/.ghcup/env" ] && source "${GHCUP_INSTALL_BASE_PREFIX:=$HOME}/.ghcup/env"