From e35aaebb534eafb30ba8662ea6624b4955aa4070 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sun, 22 Sep 2024 16:21:35 +0800 Subject: fixed wall rendering last wall, changed ffmpeg logic, enabled hardware accel --- mpvpaper.sh | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'mpvpaper.sh') diff --git a/mpvpaper.sh b/mpvpaper.sh index 9116a50..474a361 100755 --- a/mpvpaper.sh +++ b/mpvpaper.sh @@ -3,7 +3,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/live-wallpapers/" -current_bg="$(cat $XDG_CACHE_HOME/current.bg)" # colors RED='\033[0;31m' @@ -13,14 +12,14 @@ NC='\033[0m' DELAY=1800 while true; do - wallpappath=$(find "$WALLPAPERS" | shuf -n 1) + current_bg="$(cat $XDG_CACHE_HOME/current.bg)" if ! [ "$current_bg" ]; then - echo -e "${RED}current.bg not set, setting it to $wallpappath${NC}" - echo "$wallpappath" > $XDG_CACHE_HOME/current.bg - current_bg="$wallpappath" + echo -e "${RED}current.bg not set, regenerating it${NC}" + current_bg="$(find "$WALLPAPERS" | shuf -n 1)" + echo "$current_bg" > $XDG_CACHE_HOME/current.bg echo -e "${GREEN}Regenerating wallpappath${NC}" - wallpappath=$(find "$WALLPAPERS" | shuf -n 1) fi + wallpappath=$(find "$WALLPAPERS" | shuf -n 1) # wallust run --skip-sequences $current_bg # wallust run --backend kmeans --skip-sequences $current_bg & # using cache now @@ -30,18 +29,18 @@ while true; do done wallust run --backend full --skip-sequences "$XDG_CACHE_HOME/$(basename $current_bg).png" & + echo "$XDG_CACHE_HOME/$(basename $current_bg).png" swaync-client --reload-css - prime-run ffmpeg -i "$current_bg" -y -ss 00:00:01 -vframes 1 "$XDG_CACHE_HOME/bg.png" & - echo $current_bg + prime-run ffmpeg -hwaccel cuda -i "$current_bg" -y "$XDG_CACHE_HOME/bg.png" & current_bg=$(cat "$XDG_CACHE_HOME/current.bg") echo "$wallpappath" > "$XDG_CACHE_HOME/current.bg" # update hyprlock killall -SIGUSR2 hyprlock - ( prime-run ffmpeg -i "$current_bg" -y -ss 00:00:01 -vframes 1 "$XDG_CACHE_HOME/$(basename $wallpappath).png" && nice -n 20 wallust run --backend full --skip-templates --skip-sequences "$XDG_CACHE_HOME/$(basename $wallpappath).png" ) & + ( prime-run 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" ) & - sleep $DELAY + nice -n 20 sleep $DELAY done -- cgit v1.2.3