aboutsummaryrefslogtreecommitdiff
path: root/scripts/set_random
diff options
context:
space:
mode:
authoreric.marin <maarin.eric@gmail.com>2024-12-26 14:33:06 +0100
committereric.marin <maarin.eric@gmail.com>2024-12-30 21:07:42 +0100
commit4de5a217c25fe83bb54063f8d842b78c9e6d7fb3 (patch)
tree0460bc0600492324f111524dfdff1ef85c9fbf8e /scripts/set_random
parentee2b01a3fff043a8b977385227c2659bbcf2e59a (diff)
downloaddotfiles-4de5a217c25fe83bb54063f8d842b78c9e6d7fb3.tar.gz
dotfiles-4de5a217c25fe83bb54063f8d842b78c9e6d7fb3.zip
wallust
Diffstat (limited to 'scripts/set_random')
-rwxr-xr-xscripts/set_random14
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/set_random b/scripts/set_random
new file mode 100755
index 0000000..cdc4018
--- /dev/null
+++ b/scripts/set_random
@@ -0,0 +1,14 @@
+#!/usr/bin/fish
+
+if test (count $argv) -lt 1; or not test -d $argv[1]
+ echo "Usage: $(status filename) <dir>"
+ exit 1
+end
+
+~/.config/scripts/set_background (
+ for file in (find $argv[1] -type f)
+ if test -z $img; or test $file != $img
+ echo (math (random) % 1000)":$file"
+ end
+ end | sort -n | head -n 1 | cut -d ':' -f2)
+