氮——恢复到比例背景
nitrogen --restore to scale background
所以我在网上找到了一个脚本,发现它很适合我的需要。基本上它会编辑文件 nitrogen 将它保存的墙纸放在另一张图片中,所以我可以使用 cron 作业定期更改墙纸。
#!/bin/bash
WPDIR="$HOME/Wallpapers"
random=true
apply=true
wpfile=""
function usage {
if [ -eq 1 ]; then
stream=2
exitcode=255
else
stream=1
exitcode=0
fi
echo "Usage: $(basename [=10=]) [-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 [ "" = "--help" -o "" == "-h" ]; then
usage 0
elif [ "" = "--noapply" -o "" = "-n" ]; then
apply=false
else
if ! $random; then
usage 1
elif [ ! -f "" ]; then
echo "file '' not found" >&2
exit 1
fi
random=false
{ cd $(dirname ""); dir=$(pwd); }
wpfile="$dir/$(basename "")"
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
我的问题是图片的缩放比例。我不能用这种方式将其设置为自动填充。
我不好,我应该心疼。写入 >$HOME/.config/nitrogen/bg-saved.cfg 时,模式已设置。这种模式实际上就是氮气提供的模式。尝试使用氮气并查看文件中设置的模式。 zoomed-fill = 5,以我为例。
所以我在网上找到了一个脚本,发现它很适合我的需要。基本上它会编辑文件 nitrogen 将它保存的墙纸放在另一张图片中,所以我可以使用 cron 作业定期更改墙纸。
#!/bin/bash
WPDIR="$HOME/Wallpapers"
random=true
apply=true
wpfile=""
function usage {
if [ -eq 1 ]; then
stream=2
exitcode=255
else
stream=1
exitcode=0
fi
echo "Usage: $(basename [=10=]) [-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 [ "" = "--help" -o "" == "-h" ]; then
usage 0
elif [ "" = "--noapply" -o "" = "-n" ]; then
apply=false
else
if ! $random; then
usage 1
elif [ ! -f "" ]; then
echo "file '' not found" >&2
exit 1
fi
random=false
{ cd $(dirname ""); dir=$(pwd); }
wpfile="$dir/$(basename "")"
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
我的问题是图片的缩放比例。我不能用这种方式将其设置为自动填充。
我不好,我应该心疼。写入 >$HOME/.config/nitrogen/bg-saved.cfg 时,模式已设置。这种模式实际上就是氮气提供的模式。尝试使用氮气并查看文件中设置的模式。 zoomed-fill = 5,以我为例。