aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local/bin
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2022-08-31 19:26:39 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2022-08-31 19:26:39 +0300
commitcbf22e631a6e5b9129a95b192a29c8215e9917ed (patch)
treeb1058b3c38be29cf39658c60d8395398fead8ed3 /dotfiles/.local/bin
parent6e078e8764b5124ca91679ee55fac28d60e202f5 (diff)
downloadswayrice-cbf22e631a6e5b9129a95b192a29c8215e9917ed.tar.gz
swayrice-cbf22e631a6e5b9129a95b192a29c8215e9917ed.zip
imgurl: use a different file name
to avoid file name too long errors
Diffstat (limited to 'dotfiles/.local/bin')
-rwxr-xr-xdotfiles/.local/bin/imgurl5
1 files changed, 4 insertions, 1 deletions
diff --git a/dotfiles/.local/bin/imgurl b/dotfiles/.local/bin/imgurl
index f9cad49..c594712 100755
--- a/dotfiles/.local/bin/imgurl
+++ b/dotfiles/.local/bin/imgurl
@@ -2,5 +2,8 @@
[ -z "$1" ] && exit
-setsid curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && nsxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 &
+base="$(basename $1)"
+ext="${base##*.}"
+fname="/tmp/imgurl-$(date '+%s').$ext"
+setsid curl -sL "$1" > "$fname" && nsxiv -a "$fname" &