Adding screenshot script and changing them all to use /bin/sh
This commit is contained in:
parent
7c0ec217da
commit
58f4e25831
2 changed files with 37 additions and 12 deletions
|
@ -1,36 +1,44 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
if [ ! -f "$1" ]; then
|
|
||||||
kdialog --passivepopup "No File!" 5
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
base=${1%.*}
|
base=${1%.*}
|
||||||
baseName=$(basename "$1")
|
baseName=$(basename "$1")
|
||||||
ext=${baseName##*.}
|
ext=${baseName##*.}
|
||||||
variable=$(openssl rand -hex 8)
|
variable=$(openssl rand -hex 8)
|
||||||
remote_path=/var/www/html/images #this is the path the file will be uploaded to
|
REMOTE_NAME=remote
|
||||||
|
REMOTE_PATH=/var/www/html/images #this is the path the file will be uploaded to
|
||||||
|
REMOTE_URL=https://example.org/images #no / at end
|
||||||
|
MAX_COLLISSIONS=5
|
||||||
|
|
||||||
|
if [ ! -f "$1" ]; then
|
||||||
|
kdialog --passivepopup "No File!" 5
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
i=1
|
i=1
|
||||||
|
|
||||||
while [ -f "$1" ]
|
while [ -f "$1" ]
|
||||||
do
|
do
|
||||||
|
|
||||||
rclone moveto "$1" remote:"$remote_path/$variable.$ext" -v --ignore-existing # ignore existing in case the file already exists
|
rclone moveto "$1" "$REMOTE_NAME":"$REMOTE_PATH/$variable.$ext" -v --ignore-existing # ignore existing in case the file already exists
|
||||||
|
|
||||||
if [ -f "$1" ]; then # if the file is still in /tmp we must've gotten some kind of error, we assume its a Collision
|
if [ -e "$1" ] && [ "$i" -lt $MAX_COLLISSIONS ]; then # if the file is still in /tmp we must've gotten some kind of error, we assume its a Collision
|
||||||
kdialog --sorry "Collision $i"
|
kdialog --sorry "Collision $i"
|
||||||
i=$((i+1))
|
i=$((i+1))
|
||||||
variable=$(openssl rand -hex 8)
|
variable=$(openssl rand -hex 8)
|
||||||
|
elif [ "$i" -gt $((MAX_COLLISSIONS-1)) ]; then
|
||||||
|
kdialog --error "Too many collisions, file still exists at $1. Attempts: $i"
|
||||||
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
if [ "$XDG_SESSION_TYPE" == "x11" ]; then
|
if [ "$XDG_SESSION_TYPE" == "x11" ]; then
|
||||||
echo "$remote_path/$variable.$ext" | xclip -selection clipboard
|
echo "$REMOTE_URL/$variable.$ext" | xclip -selection clipboard
|
||||||
else
|
else
|
||||||
wl-copy "$remote_path/$variable.$ext" &> /dev/null
|
wl-copy "$REMOTE_URL/$variable.$ext" &> /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
kdialog --passivepopup "Uploaded! $remote_path/$variable.$ext" 5
|
kdialog --passivepopup "Uploaded! $REMOTE_URL/$variable.$ext" 5
|
||||||
ffplay /usr/share/sounds/freedesktop/stereo/service-login.oga -hide_banner -autoexit -nodisp
|
ffplay /usr/share/sounds/freedesktop/stereo/service-login.oga -hide_banner -autoexit -nodisp
|
||||||
|
|
||||||
|
|
17
spectacle.sh
Executable file
17
spectacle.sh
Executable file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/sh
|
||||||
|
TEMP_IMAGE_PATH="/tmp/ion.png"
|
||||||
|
script_dir="$(dirname "$(realpath "$0")")" #DONOTMODIFY
|
||||||
|
UPLOAD_SCRIPT_PATH="${script_dir}/plasma_upload.sh" #Only modify if you changed the upload script name or path
|
||||||
|
|
||||||
|
spectacle -rbn -o $TEMP_IMAGE_PATH
|
||||||
|
if [ -f /tmp/ion.png ]; then
|
||||||
|
cjpegli -d 0 --chroma_subsampling=444 $TEMP_IMAGE_PATH $TEMP_IMAGE_PATH.jpeg
|
||||||
|
#oxipng -s -o max $TEMP_IMAGE_PATH
|
||||||
|
#cjpeg -optimize -progressive -quality 100 $TEMP_IMAGE_PATH > $TEMP_IMAGE_PATH.jpeg
|
||||||
|
rm $TEMP_IMAGE_PATH -v
|
||||||
|
|
||||||
|
"${UPLOAD_SCRIPT_PATH}" $TEMP_IMAGE_PATH.jpeg #change this to $TEMP_IMAGE_PATH without jpeg at the end when using oxipng!!!!
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
kdialog --passivepopup "Cancelled!" 5
|
||||||
|
ffplay /usr/share/sounds/ocean/stereo/completion-partial.oga -hide_banner -autoexit -nodisp
|
Loading…
Add table
Reference in a new issue