From 7a053c5fb996f22bcf0eedf7d294fbc30da3d81b Mon Sep 17 00:00:00 2001 From: Tyler Kelley Date: Tue, 16 Jan 2024 15:54:53 -0600 Subject: [PATCH] improve wallsetter script --- config/scripts/wallsetter.nix | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/config/scripts/wallsetter.nix b/config/scripts/wallsetter.nix index aa258b1..9ecca9e 100644 --- a/config/scripts/wallsetter.nix +++ b/config/scripts/wallsetter.nix @@ -1,19 +1,24 @@ { pkgs }: pkgs.writeShellScriptBin "wallsetter" '' -WALLPAPER=$(find $HOME/Pictures/Wallpapers -type l | shuf -n 1) -PREVIOUS=$WALLPAPER +TIMEOUT=5 +OSRELEASE=$(cat /etc/os-release | grep nixos | shuf -n 1) +FILETYPE="l" TRANSITION1="--transition-type wave --transition-angle 120 --transition-step 30" TRANSITION2="--transition-type wipe --transition-angle 30 --transition-step 30" TRANSITION3="--transition-type center --transition-step 30" TRANSITION4="--transition-type outer --transition-pos 0.3,0.8 --transition-step 30" TRANSITION5="--transition-type wipe --transition-angle 270 --transition-step 30" +[[ ! -z "$testvar" ]] && $FILETYPE="l" || $FILETYPE="f" +WALLPAPER=$(find $HOME/Pictures/Wallpapers -type $FILETYPE | shuf -n 1) +PREVIOUS=$WALLPAPER + while true; do if [ $WALLPAPER == $PREVIOUS ] then - WALLPAPER=$(find $HOME/Pictures/Wallpapers -type l | shuf -n 1) + WALLPAPER=$(find $HOME/Pictures/Wallpapers -type $FILETYPE | shuf -n 1) else PREVIOUS=$WALLPAPER NUM=$(shuf -i 1-5 -n 1) @@ -35,7 +40,7 @@ do ;; esac ${pkgs.swww}/bin/swww img $WALLPAPER $TRANSITION - sleep 120 + sleep $TIMEOUT fi done ''