diff options
| author | Ja.KooLit <85185940+JaKooLit@users.noreply.github.com> | 2024-10-03 23:31:16 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-03 23:31:16 +0900 |
| commit | 812d9974858f209046c2ba3ab3a10efc85c3276e (patch) | |
| tree | f13ed76db275f9aa0fc721e4da541367c2104ac3 /config/hypr/scripts/DarkLight.sh | |
| parent | 14652e5d6b778f20b2030549c5218cd9656b8cc2 (diff) | |
| parent | 10566db5346f0a9a59a7fb3b717289cceb903e60 (diff) | |
Merge pull request #461 from SuJin353/PersonalChange
feat: change dark light wallpaper to its opposite wallpaper
Diffstat (limited to 'config/hypr/scripts/DarkLight.sh')
| -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..3b9afabb 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/Light/Dark}" +elif [ "$next_mode" = "Light" ] && [ -f "$dark_wallpapers/$current_wallpaper" ]; then + next_wallpaper="$light_wallpapers/${current_wallpaper/Dark/Light}" 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" \) -print0 | shuf -n1 -z | xargs -0)" + else + next_wallpaper="$(find "${light_wallpapers}" -type f \( -iname "*.jpg" -o -iname "*.png" \) -print0 | shuf -n1 -z | xargs -0)" + fi fi # Update wallpaper using swww command |
