44 lines
1002 B
Bash
Executable File
44 lines
1002 B
Bash
Executable File
#!/bin/bash
|
|
|
|
cd `dirname $0`
|
|
. ./config/shareshellx.cfg
|
|
|
|
upload() {
|
|
mimetype=$(file --mime-type -b $file | cut -f2 -d" ")
|
|
url=$(curl $uri \
|
|
-H "Content-Type: $mimetype" \
|
|
-H "authentication: $token" \
|
|
-H "filename: $(basename $file)" \
|
|
--data-binary @$file)
|
|
|
|
echo $url | xclip -selection clipboard
|
|
notify-send -i "$file" upload "$url"
|
|
aplay ./sound/sharex/done.wav
|
|
}
|
|
|
|
file_selection() {
|
|
file=$(zenity --file-selection)
|
|
case $? in
|
|
0 ) upload ;;
|
|
1 | -1) exit 0 ;;
|
|
esac
|
|
}
|
|
|
|
take_screenshot() {
|
|
file=$(mktemp -p /run/user/$(id -u) --suffix .png)
|
|
|
|
xfce4-screenshooter -s $file $1
|
|
aplay ./sound/sharex/capture.wav
|
|
|
|
upload
|
|
|
|
rm $file
|
|
}
|
|
|
|
case $1 in
|
|
"-w" | "--current-window") take_screenshot --window ;;
|
|
"-f" | "--fullscreen" ) take_screenshot --fullscreen ;;
|
|
"-r" | "--select-region" ) take_screenshot --region ;;
|
|
"-s" | "--select-file" ) file_selection ;;
|
|
esac
|