aboutsummaryrefslogtreecommitdiff
path: root/scripts/set_random
blob: cdc40187cc1b63568566bb76556de17eb373f7f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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)