1
0
Fork 0

crop wallpaper, span the whole screen

This commit is contained in:
Massaki Archambault 2018-05-17 12:30:04 -04:00
parent 88630141c3
commit 3426a419fb
1 changed files with 5 additions and 5 deletions

View File

@ -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')" 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 set -- $screen_size
# download and resize # download, crop and scale
ffmpeg -i "$wallpaper_source" -vf "scale=w=$1:h=$2:force_original_aspect_ratio=decrease" \ 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 -preset slow -r 30 "$wallpaper_anim" -c:v libx264 -tune fastdecode -preset ultrafast -crf 18 -r 15 "$wallpaper_anim"
# extract static image # extract static image
ffmpeg -i "$wallpaper_anim" -vframes 1 "$wallpaper_static" ffmpeg -i "$wallpaper_anim" -vframes 1 "$wallpaper_static"
# set static wallpaper # set static wallpaper
feh --bg-fill "$wallpaper_static" feh --bg-fill --no-xinerama "$wallpaper_static"
fi fi
if ! acpi --ac-adapter 2>/dev/null | grep -q 'off-line'; then if ! acpi --ac-adapter 2>/dev/null | grep -q 'off-line'; then
exec "$HOME/.local/bin/mpv-bg" --really-quiet \ 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" --loop --panscan=1.0 --scale=oversample --cache-file=TMP "$wallpaper_anim"
fi fi