-1

so I found a script online and found it pretty suitable to my needs. basically it edits the file nitrogen places it's saved wallpaper in to another picture, so I can change the wallpaper periodically with a cron job.

#!/bin/bash

WPDIR="$HOME/Wallpapers"

random=true
apply=true
wpfile=""

function usage {
if [ $1 -eq 1 ]; then
    stream=2
    exitcode=255
else
    stream=1
    exitcode=0
fi
echo "Usage: $(basename $0) [-n|--noapply] [-h|--help]         [wallpaper_location]" >&$stream
echo "If wallpaper location is not given a random wallpaper from $WPDIR will be chosen" >&$stream
exit $exitcode
}

# handle arguments
while [ $# -gt 0 ]; do
if [ "$1" = "--help" -o "$1" == "-h" ]; then
    usage 0
elif [ "$1" = "--noapply" -o "$1" = "-n" ]; then
    apply=false
else
    if ! $random; then
        usage 1
    elif [ ! -f "$1" ]; then
        echo "file '$1' not found" >&2
        exit 1
    fi
    random=false
    { cd $(dirname "$1"); dir=$(pwd); }
    wpfile="$dir/$(basename "$1")"
fi
shift
done

if $random; then
wpfile=$(ls "$WPDIR"/*.jpg | sort -R | head -n 1)
echo "chose $wpfile" >&2
fi

cat >$HOME/.config/nitrogen/bg-saved.cfg <<EOF
[:0.0]
file=$wpfile
mode=4
bgcolor=# 0 0 0
EOF

if $apply; then
nitrogen  --restore
fi

my problem is the scaling of the pictures. I can't set it to auto-fill this way.

roqstr
  • 554
  • 3
  • 8
  • 23

1 Answers1

0

I'm bad, I should feel bad. When writing to >$HOME/.config/nitrogen/bg-saved.cfg , the mode is set. this mode is literally the mode nitrogen provides. Try a bit around with nitrogen and look what mode is set in the file. zoomed-fill = 5, for my example.

roqstr
  • 554
  • 3
  • 8
  • 23