Changes to pb script.

This commit is contained in:
Bartek Stalewski 2021-10-07 16:31:54 +02:00
parent ad1713254e
commit 9930348155

View file

@ -1,8 +1,4 @@
#!/usr/bin/env bash
# $HOME/.local/bin/pb
# upload files to 0x0.st
# 0x0 - client for 0x0.st
# Usage: `0x0.sh file`
me=${0##*/}
host=https://0x0.st
@ -23,9 +19,9 @@ EOF
}
clip() {
if command -v xclip >/dev/null 2>&1;then
echo "$@" | xclip -selection c
notify-send "0x0" "Successfully uploaded.\nURL: $@"
if command -v xsel >/dev/null 2>&1;then
echo -n "$@" | xsel -l /dev/null
dunstify -u normal "content uploaded" "$@"
fi
}
@ -62,12 +58,6 @@ upload_url() {
clip "${uploaded}"
}
# 1KiB = 1024 bytes
# 1MiB = 1024 KiB
# max size - 256MiB
max_size=$(( (1024*1024) * 256 ))
if [[ -f "$1" || "$#" -lt 1 ]];then
mode="default"
else