aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Kavanagh <rak@rak.ac>2024-01-03 09:11:52 -0500
committerRyan Kavanagh <rak@rak.ac>2024-01-03 09:12:08 -0500
commit5d90852a868c6e2f0167401f260ef88321eaa7df (patch)
tree18cc4fce0102da57c6d34d5fbd9bbc5a0e9f569a
parentStart emacs daemon from systemd (diff)
randomize bg
Diffstat (limited to '')
-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