From 96c8731c471d309fbb4730fd1e5669f43e0f7ca4 Mon Sep 17 00:00:00 2001 From: Tyler Kelley Date: Sat, 20 Jan 2024 21:34:02 -0600 Subject: [PATCH] Fixed wallsetter not accepting wallpapers with spaces --- config/scripts/wallsetter.nix | 19 +++++++++++-------- flake.nix | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/config/scripts/wallsetter.nix b/config/scripts/wallsetter.nix index 1d4c667..8559765 100644 --- a/config/scripts/wallsetter.nix +++ b/config/scripts/wallsetter.nix @@ -1,23 +1,26 @@ { pkgs, username, wallpaperDir, wallpaperGit, ... }: pkgs.writeShellScriptBin "wallsetter" '' - TIMEOUT=720 + TIMEOUT=5 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" - WALLPAPER=$(find ${wallpaperDir}/* -type f | shuf -n 1) + WALLPAPER=$(find $HOME/Pictures/Wallpapers/ -name '*' | awk '!/.git/' | tail -n +2 | sed 's/ /\\ /g' | shuf -n 1) PREVIOUS=$WALLPAPER - rm -rf ${wallpaperDir} - ${pkgs.git}/bin/git clone ${wallpaperGit} ${wallpaperDir} - sleep 1 - chown -R ${username}:users ${wallpaperDir} + if [ -d ${wallpaperDir} ]; then + cd ${wallpaperDir} + git pull + else + ${pkgs.git}/bin/git clone ${wallpaperGit} ${wallpaperDir} + chown -R ${username}:users ${wallpaperDir} + fi while true; do - if [ $WALLPAPER == $PREVIOUS ] + if [ "$WALLPAPER" == "$PREVIOUS" ] then - WALLPAPER=$(find ${wallpaperDir}/* -type f | shuf -n 1) + WALLPAPER=$(find $HOME/Pictures/Wallpapers/ -name '*' | awk '!/.git/' | tail -n +2 | sed 's/ /\\ /g' | shuf -n 1) else PREVIOUS=$WALLPAPER NUM=$(shuf -i 1-5 -n 1) diff --git a/flake.nix b/flake.nix index 24c595f..4e8c177 100644 --- a/flake.nix +++ b/flake.nix @@ -20,7 +20,7 @@ gitEmail = "tylerzanekelley@gmail.com"; theLocale = "en_US.UTF-8"; theTimezone = "America/Chicago"; - theme = "gruvbox-dark-medium"; + theme = "tokyo-night-storm"; browser = "firefox"; wallpaperGit = "https://gitlab.com/Zaney/my-wallpapers.git"; wallpaperDir = "/home/${username}/Pictures/Wallpapers";