27 lines
705 B
Nix
Executable File
27 lines
705 B
Nix
Executable File
{ pkgs }:
|
|
|
|
pkgs.writeShellScriptBin "wallpaper_changer" ''
|
|
|
|
script_name=''${BASH_SOURCE[0]}
|
|
for pid in $(pidof -x "$script_name"); do
|
|
if [ "$pid" != $$ ]; then
|
|
kill -15 "$pid"
|
|
fi
|
|
done
|
|
|
|
[ "$XDG_SESSION_TYPE" != "wayland" ] && echo "Not a Wayland session, exiting." && exit 1
|
|
wallpaper_dir="$HOME/.local/share/bg/"
|
|
|
|
kill -15 $(pidof -x "swww-daemon")
|
|
kill -15 $(pidof -x "swww")
|
|
${pkgs.swww}/bin/swww-daemon &
|
|
|
|
while true; do
|
|
find "$wallpaper_dir" -type f -follow \( -iname \*.jpg -o -iname \*.png -o -iname \*.gif -o -iname \*.bmp \) | shuf | while read -r file; do
|
|
${pkgs.swww}/bin/swww img "$file" --transition-step 10 --transition-fps 60
|
|
sleep 600
|
|
done
|
|
done
|
|
|
|
''
|