From 1e3008abf3d08ed63dcecf010a842ca81b3635d3 Mon Sep 17 00:00:00 2001 From: Tyler Kelley Date: Mon, 15 Jan 2024 16:04:30 -0600 Subject: [PATCH] Improve the wallsetter script --- config/scripts/wallsetter.nix | 38 +++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/config/scripts/wallsetter.nix b/config/scripts/wallsetter.nix index d851720..238e3f1 100644 --- a/config/scripts/wallsetter.nix +++ b/config/scripts/wallsetter.nix @@ -1,7 +1,41 @@ { pkgs }: pkgs.writeShellScriptBin "wallsetter" '' - NEWWALLPAPER=$(find $HOME/Pictures/Wallpapers -type l | shuf -n 1) +WALLPAPER=$(find $HOME/Pictures/Wallpapers -type f | shuf -n 1) +PREVIOUS=$WALLPAPER +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" - ${pkgs.swww}/bin/swww img $NEWWALLPAPER --transition-type wave --transition-angle 120 --transition-step 30 +while true; +do + if [ $WALLPAPER == $PREVIOUS ] + then + WALLPAPER=$(find $HOME/Pictures/Wallpapers -type f | shuf -n 1) + else + PREVIOUS=$WALLPAPER + NUM=$(shuf -i 1-5 -n 1) + case $NUM in + 1) + TRANSITION=$TRANSITION1 + ;; + 2) + TRANSITION=$TRANSITION2 + ;; + 3) + TRANSITION=$TRANSITION3 + ;; + 4) + TRANSITION=$TRANSITION4 + ;; + 5) + TRANSITION=$TRANSITION5 + ;; + esac + ${pkgs.swww}/bin/swww img $WALLPAPER $TRANSITION + sleep 120 + fi +done ''