Fixed wallsetter not accepting wallpapers with spaces

This commit is contained in:
Tyler Kelley 2024-01-20 21:34:02 -06:00
parent 5419daba34
commit 96c8731c47
2 changed files with 12 additions and 9 deletions

View File

@ -1,23 +1,26 @@
{ pkgs, username, wallpaperDir, wallpaperGit, ... }: { pkgs, username, wallpaperDir, wallpaperGit, ... }:
pkgs.writeShellScriptBin "wallsetter" '' pkgs.writeShellScriptBin "wallsetter" ''
TIMEOUT=720 TIMEOUT=5
TRANSITION1="--transition-type wave --transition-angle 120 --transition-step 30" TRANSITION1="--transition-type wave --transition-angle 120 --transition-step 30"
TRANSITION2="--transition-type wipe --transition-angle 30 --transition-step 30" TRANSITION2="--transition-type wipe --transition-angle 30 --transition-step 30"
TRANSITION3="--transition-type center --transition-step 30" TRANSITION3="--transition-type center --transition-step 30"
TRANSITION4="--transition-type outer --transition-pos 0.3,0.8 --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" 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 PREVIOUS=$WALLPAPER
rm -rf ${wallpaperDir} if [ -d ${wallpaperDir} ]; then
${pkgs.git}/bin/git clone ${wallpaperGit} ${wallpaperDir} cd ${wallpaperDir}
sleep 1 git pull
chown -R ${username}:users ${wallpaperDir} else
${pkgs.git}/bin/git clone ${wallpaperGit} ${wallpaperDir}
chown -R ${username}:users ${wallpaperDir}
fi
while true; while true;
do do
if [ $WALLPAPER == $PREVIOUS ] if [ "$WALLPAPER" == "$PREVIOUS" ]
then 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 else
PREVIOUS=$WALLPAPER PREVIOUS=$WALLPAPER
NUM=$(shuf -i 1-5 -n 1) NUM=$(shuf -i 1-5 -n 1)

View File

@ -20,7 +20,7 @@
gitEmail = "tylerzanekelley@gmail.com"; gitEmail = "tylerzanekelley@gmail.com";
theLocale = "en_US.UTF-8"; theLocale = "en_US.UTF-8";
theTimezone = "America/Chicago"; theTimezone = "America/Chicago";
theme = "gruvbox-dark-medium"; theme = "tokyo-night-storm";
browser = "firefox"; browser = "firefox";
wallpaperGit = "https://gitlab.com/Zaney/my-wallpapers.git"; wallpaperGit = "https://gitlab.com/Zaney/my-wallpapers.git";
wallpaperDir = "/home/${username}/Pictures/Wallpapers"; wallpaperDir = "/home/${username}/Pictures/Wallpapers";