diff options
author | Yaroslav de la Peña Smirnov <yps@yaroslavps.com> | 2022-08-31 19:26:39 +0300 |
---|---|---|
committer | Yaroslav de la Peña Smirnov <yps@yaroslavps.com> | 2022-08-31 19:26:39 +0300 |
commit | cbf22e631a6e5b9129a95b192a29c8215e9917ed (patch) | |
tree | b1058b3c38be29cf39658c60d8395398fead8ed3 /dotfiles/.local | |
parent | 6e078e8764b5124ca91679ee55fac28d60e202f5 (diff) | |
download | swayrice-cbf22e631a6e5b9129a95b192a29c8215e9917ed.tar.gz swayrice-cbf22e631a6e5b9129a95b192a29c8215e9917ed.zip |
imgurl: use a different file name
to avoid file name too long errors
Diffstat (limited to 'dotfiles/.local')
-rwxr-xr-x | dotfiles/.local/bin/imgurl | 5 |
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" & |