diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-04-27 18:29:58 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-04-27 18:29:58 +0800 |
| commit | cddeebd21b7e0bee1b8f97d74d9ef74b40abc54b (patch) | |
| tree | a6396189f7cc9d0156f0a46b1fc13c4943c6f566 | |
| parent | 5f52a98caa3a15eff093ec4a7d8f093dd411691c (diff) | |
walls: organize into one dir
| -rwxr-xr-x | walls/mpvpaper.sh (renamed from mpvpaper.sh) | 26 | ||||
| -rwxr-xr-x | walls/swww.sh (renamed from swww.sh) | 13 | ||||
| -rwxr-xr-x | walls/update.sh | 40 | ||||
| -rwxr-xr-x | walls/wallpapertrans.sh (renamed from wallpapertrans.sh) | 0 |
4 files changed, 49 insertions, 30 deletions
diff --git a/mpvpaper.sh b/walls/mpvpaper.sh index 99acfb7..4d9a490 100755 --- a/mpvpaper.sh +++ b/walls/mpvpaper.sh @@ -50,30 +50,14 @@ while true; do # done - wallust run --backend full --skip-sequences "$XDG_CACHE_HOME/$(basename "$current_bg").png" + # Update theme and configurations for current wallpaper + nice -n 20 bash "$(dirname "$0")/update.sh" "$current_bg" - # tell hypr* where is bg - echo "\$bg = $XDG_CACHE_HOME/$(basename "$current_bg").png" > "$XDG_CONFIG_HOME/hypr/bg.conf" - - echo "$XDG_CACHE_HOME/$(basename "$current_bg").png" - - # reload hyprland - hyprctl reload config-only & - - swaync-client --reload-css & # & pywalfox update - - gdbus call --session --dest com.mitchellh.ghostty --object-path /com/mitchellh/ghostty --method org.gtk.Actions.Activate reload-config [] [] & - - # update hyprlock - killall -USR2 hyprlock & - - # next wallpaper - ffmpeg -hwaccel cuda -i "$current_bg" -y "$XDG_CACHE_HOME/bg.png" - current_bg=$(cat "$XDG_CACHE_HOME/current.bg") + # Store next wallpaper path echo "$wallpappath" > "$XDG_CACHE_HOME/current.bg" - # generates cache for next wallpaper - ( ffmpeg -hwaccel cuda -i "$wallpappath" -y "$XDG_CACHE_HOME/$(basename $wallpappath).png"; nice -n 20 wallust run --backend full --skip-templates --skip-sequences "$XDG_CACHE_HOME/$(basename $wallpappath).png" ) & + # Generate cache for next wallpaper in background + ( nice -n 20 bash "$(dirname "$0")/update.sh" "$wallpappath" ) & nice -n 20 sleep $DELAY done @@ -4,7 +4,6 @@ XDG_PICTURES_DIR="${XDG_PICTURES_DIR:-$HOME/Pictures}" XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}" XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}" WALLPAPERS="$XDG_PICTURES_DIR/wallpapers/" -current_bg="$(cat $XDG_CACHE_HOME/current.bg)" swwwarg="--transition-type random --transition-duration 0.85 --transition-fps 160 --transition-bezier 1,0.33,0.3,1" # colors @@ -23,15 +22,16 @@ while true; do echo -e "${GREEN}Regenerating wallpappath${NC}" wallpappath=$(find "$WALLPAPERS" | shuf -n 1) fi + current_bg="$(cat $XDG_CACHE_HOME/current.bg)" # wallust run --skip-sequences $(cat $XDG_CACHE_HOME/current.bg) # wallust run --backend kmeans --skip-sequences $(cat $XDG_CACHE_HOME/current.bg) & # using cache now - swww img $(cat $XDG_CACHE_HOME/current.bg) $swwwarg - wallust run --backend full --skip-sequences $(cat $XDG_CACHE_HOME/current.bg) + swww img $current_bg $swwwarg + wallust run --backend full --skip-sequences $(cat $XDG_CACHE_HOME/current.bg) & # (sleep 0.1; pgrep -f wallust && wallust run --backend kmeans --skip-sequences $(cat $XDG_CACHE_HOME/current.bg)) & # tell hypr* where is bg - echo "\$bg = $XDG_CACHE_HOME/$(basename "$current_bg").png" > "$XDG_CONFIG_HOME/hypr/bg.conf" + echo "\$bg = $current_bg" > "$XDG_CONFIG_HOME/hypr/bg.conf" # reload hyprland hyprctl reload config-only & @@ -41,11 +41,6 @@ while true; do gdbus call --session --dest com.mitchellh.ghostty --object-path /com/mitchellh/ghostty --method org.gtk.Actions.Activate reload-config [] [] & current_bg=$(cat $XDG_CACHE_HOME/current.bg) - if [[ $current_bg == *.jpg ]]; then - magick convert $current_bg $XDG_CACHE_HOME/bg.png & - else - cp $current_bg $XDG_CACHE_HOME/bg.png - fi echo $wallpappath > $XDG_CACHE_HOME/current.bg # update hyprlock killall -SIGUSR2 hyprlock diff --git a/walls/update.sh b/walls/update.sh new file mode 100755 index 0000000..e2d9bbe --- /dev/null +++ b/walls/update.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# ARG1 = wallpaper path + +XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}" +XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}" + +RED='\033[0;31m' +GREEN='\033[0;32m' +NC='\033[0m' + +if [ -z "$1" ]; then + echo -e "${RED}Error: No wallpaper path provided${NC}" + exit 1 +fi + +WALLPAPER="$1" + +if [ ! -f "$XDG_CACHE_HOME/$(basename "$WALLPAPER").png" ]; then + echo -e "${GREEN}Generating PNG cache for $WALLPAPER${NC}" + ffmpeg -hwaccel cuda -i "$WALLPAPER" -y "$XDG_CACHE_HOME/$(basename "$WALLPAPER").png" +fi + +wallust run --backend full --skip-sequences "$XDG_CACHE_HOME/$(basename "$WALLPAPER").png" + +echo "\$bg = $XDG_CACHE_HOME/$(basename "$WALLPAPER").png" > "$XDG_CONFIG_HOME/hypr/bg.conf" + +ffmpeg -hwaccel cuda -i "$WALLPAPER" -y "$XDG_CACHE_HOME/bg.png" + +( + hyprctl reload config-only & + + swaync-client --reload-css & + + gdbus call --session --dest com.mitchellh.ghostty --object-path /com/mitchellh/ghostty --method org.gtk.Actions.Activate reload-config [] [] & + + killall -USR2 hyprlock & +) & + +echo "$WALLPAPER" > "$XDG_CACHE_HOME/current.bg" diff --git a/wallpapertrans.sh b/walls/wallpapertrans.sh index 6c87d4a..6c87d4a 100755 --- a/wallpapertrans.sh +++ b/walls/wallpapertrans.sh |
