aboutsummaryrefslogtreecommitdiff
path: root/bin/executable_swaybg-random
diff options
context:
space:
mode:
authorRyan Kavanagh <rak@rak.ac>2024-01-05 15:14:12 -0500
committerRyan Kavanagh <rak@rak.ac>2024-01-05 15:30:51 -0500
commit01d3ac47dae36d56bf113b56c3a69d746f66a90b (patch)
tree9b7b6b0894ca81bc7df280bf3cd38e6cdfaa029f /bin/executable_swaybg-random
parentImprove environment var handling for shells and systemd (diff)
make swaybg-random friendlier
Diffstat (limited to '')
-rw-r--r--bin/executable_swaybg-random5
1 files changed, 5 insertions, 0 deletions
diff --git a/bin/executable_swaybg-random b/bin/executable_swaybg-random
index ac80495..6184e33 100644
--- a/bin/executable_swaybg-random
+++ b/bin/executable_swaybg-random
@@ -4,6 +4,11 @@
DIR=$1
PIDFILE=$XDG_RUNTIME_DIR/swaybg.pid
+if test -z "$DIR"; then
+ echo "Usage: swaybg-random dir"
+ exit 1
+fi
+
swaybg -i $(find $DIR/. -type f | shuf -n1) -m fill -o \* &
NEWPID=$!
pkill -F $PIDFILE