From 3426a419fb3f6b52110f8428fa9b4ce27a7a2a7b Mon Sep 17 00:00:00 2001 From: Massaki Archambault Date: Thu, 17 May 2018 12:30:04 -0400 Subject: [PATCH] crop wallpaper, span the whole screen --- files/.local/bin/wallpaper | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/files/.local/bin/wallpaper b/files/.local/bin/wallpaper index f01bc18..390f2aa 100755 --- a/files/.local/bin/wallpaper +++ b/files/.local/bin/wallpaper @@ -12,19 +12,19 @@ if [ ! -f "$wallpaper_anim" ]; then screen_size="$(xrandr --screen 0 | grep '^Screen' | grep -Eo 'current [0-9]+ x [0-9]+' | sed -E 's/current ([0-9]+) x ([0-9]+)/\1 \2/g')" set -- $screen_size - # download and resize - ffmpeg -i "$wallpaper_source" -vf "scale=w=$1:h=$2:force_original_aspect_ratio=decrease" \ - -c:v libx264 -preset slow -r 30 "$wallpaper_anim" + # download, crop and scale + ffmpeg -i "$wallpaper_source" -vf "scale=w=$1:h=$2:force_original_aspect_ratio=increase, crop=w=$1:h=$2:y=(in_w-out_w)" -sws_flags lanczos \ + -c:v libx264 -tune fastdecode -preset ultrafast -crf 18 -r 15 "$wallpaper_anim" # extract static image ffmpeg -i "$wallpaper_anim" -vframes 1 "$wallpaper_static" # set static wallpaper - feh --bg-fill "$wallpaper_static" + feh --bg-fill --no-xinerama "$wallpaper_static" fi if ! acpi --ac-adapter 2>/dev/null | grep -q 'off-line'; then exec "$HOME/.local/bin/mpv-bg" --really-quiet \ - --no-config --no-border --no-audio --vd-lavc-fast --x11-bypass-compositor=no \ + --no-config --no-border --no-audio --vd-lavc-fast \ --loop --panscan=1.0 --scale=oversample --cache-file=TMP "$wallpaper_anim" fi