commit aa44e88e56e2544a7e228938f90d23fd4662b791
parent 8cd61c31dbe519c77e04ca02afac0e29c0bcc30a
Author: Alex Balgavy <alex@balgavy.eu>
Date: Sun, 21 Aug 2022 21:56:41 +0200
setbg: show images in order of creation
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/setbg b/scripts/setbg
@@ -53,7 +53,7 @@ else
fi
# Choose an image
-imgpath="$(sxiv -o "$img_dir" | head -n 1)"
+imgpath="$(find "$img_dir" -type f -maxdepth 1 -exec stat -f "%SB %N" -t '%s' {} \; | sort -rn | cut -d' ' -f2- | sxiv -io | head -n 1)"
[ -z "$imgpath" ] && die 'Nothing selected, quitting.'
[ -f "$imgpath" ] || die "$imgpath does not exist or is not readable."