aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/executable_swaybg-random10
1 files changed, 10 insertions, 0 deletions
diff --git a/bin/executable_swaybg-random b/bin/executable_swaybg-random
new file mode 100644
index 0000000..ac80495
--- /dev/null
+++ b/bin/executable_swaybg-random
@@ -0,0 +1,10 @@
+#!/bin/sh
+# Usage: swaybg-random directory
+
+DIR=$1
+PIDFILE=$XDG_RUNTIME_DIR/swaybg.pid
+
+swaybg -i $(find $DIR/. -type f | shuf -n1) -m fill -o \* &
+NEWPID=$!
+pkill -F $PIDFILE
+echo $NEWPID > $PIDFILE