summaryrefslogtreecommitdiff
path: root/bin/guiscripts
diff options
context:
space:
mode:
Diffstat (limited to 'bin/guiscripts')
-rwxr-xr-xbin/guiscripts/newwal13
1 files changed, 8 insertions, 5 deletions
diff --git a/bin/guiscripts/newwal b/bin/guiscripts/newwal
index 462e1fd..87cb9ce 100755
--- a/bin/guiscripts/newwal
+++ b/bin/guiscripts/newwal
@@ -5,11 +5,14 @@ which swaybg wal identify > /dev/null || exit 1
wall="$HOME/pics/wallpaper"
wdir="$HOME/.cache/wal"
test -d "$wdir" || exit 1
-wal="$(find $HOME/pics/wallpapers -type f |
- xargs identify |
- grep 1920x1080 |
- awk '{print $1}' |
- shuf -n 1)"
+
+# if no (valid) argument, use random wallpaper
+test -f "${wal:=$(realpath "$1")}" ||
+ wal="$(find $HOME/pics/wallpapers -type f |
+ xargs identify |
+ grep 1920x1080 |
+ awk '{print $1}' |
+ shuf -n 1)"
ln -sf "$wal" "$wall"
pkill swaybg # There should be only one