diff options
| author | SuJin353 <131243461+SuJin353@users.noreply.github.com> | 2024-09-24 21:17:33 +0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-24 21:17:33 +0700 |
| commit | 7ea9e62ef8779a015c7b9d236360883431e70466 (patch) | |
| tree | c1cbef183cba016cbc7135208ddfa0d3ee6a4c90 | |
| parent | c612535e921d5b38c84b043250d1dc830a4dacb1 (diff) | |
feat: change dark light wallpaper to its opposite wallpaper
| -rwxr-xr-x | config/hypr/scripts/DarkLight.sh | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/config/hypr/scripts/DarkLight.sh b/config/hypr/scripts/DarkLight.sh index 77426902..b63a3ba2 100755 --- a/config/hypr/scripts/DarkLight.sh +++ b/config/hypr/scripts/DarkLight.sh @@ -110,14 +110,20 @@ else sed -i '/^cursor /s/^cursor .*/cursor #000000/' "${kitty_conf}" fi - - +#Get current wallpaper name +current_wallpaper=$(swww query | awk -F'/' '{print $NF}' | awk '{print $1}') # Set Dynamic Wallpaper for Dark or Light Mode -if [ "$next_mode" = "Dark" ]; then - next_wallpaper="$(find "${dark_wallpapers}" -type f \( -iname "*.jpg" -o -iname "*.png" \) -print0 | shuf -n1 -z | xargs -0)" +if [ "$next_mode" = "Dark" ] && [ -f "$light_wallpapers/$current_wallpaper" ]; then + next_wallpaper="$dark_wallpapers/$current_wallpaper" +elif [ "$next_mode" = "Light" ] && [ -f "$dark_wallpapers/$current_wallpaper" ]; then + next_wallpaper="$light_wallpapers/$current_wallpaper" else - next_wallpaper="$(find "${light_wallpapers}" -type f \( -iname "*.jpg" -o -iname "*.png" \) -print0 | shuf -n1 -z | xargs -0)" + if [ "$next_mode" = "Dark" ]; then + next_wallpaper="$(find "${dark_wallpapers}" -type f \( -iname "*.jpg" -o -iname "*.png" \) -pri> + else + next_wallpaper="$(find "${light_wallpapers}" -type f \( -iname "*.jpg" -o -iname "*.png" \) -pr> + fi fi # Update wallpaper using swww command |
