#!/bin/bash

if [[ "$(eww active-windows)" == *"home"* ]]; then
  img_dir="${HOME}/Pictures/Phone/Albums/Rattos/"
  img_list=$( find "${img_dir}" -iname '*.jpg' -or -iname '*.png' -or -iname '*.heic')
  img=$( shuf -n 1 <<< ${img_list} )
  mkdir -p "${HOME}/.cache/eww/"
  convert "${img}" -resize x300\> "${HOME}/.cache/eww/rat.jpg"
  echo "${HOME}/.cache/eww/rat.jpg"
fi
