From ca4e7f7b2fc16f846fc8804ea93a1ec71ec4a03b Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Thu, 18 May 2023 20:10:15 +0530 Subject: [PATCH] if $1 is a path to an image, set that image as wallpaper and lockpaper --- packages/scripts/chpaper.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/scripts/chpaper.sh b/packages/scripts/chpaper.sh index 8a899e3..df39a43 100755 --- a/packages/scripts/chpaper.sh +++ b/packages/scripts/chpaper.sh @@ -7,13 +7,13 @@ if [ -z "$DIR" ]; then echo "Usage: $0 " exit 1 fi -if [ ! -d "$DIR" ]; then - echo "$DIR: not a directory" - exit 1 -fi random_paper() { - find -L "${DIR}"/ -type f -regextype egrep -regex ".*\.(jpe?g|png)$" | shuf -n1 + if [ -d "$DIR" ] ; then + find -L "${DIR}"/ -type f -regextype egrep -regex ".*\.(jpe?g|png)$" | shuf -n1 + elif [ -f "$DIR" ] ; then + echo "$DIR" + fi } swww query || swww init