创建一个.sh文件
eagle@eagle-com:~$ vim background.sh
path后面的地址为你放图片的文件夹的地址。需要根据情况更改。
#!/usr/bin/env bash
# AUTHOR: eagle
# EMAIL: bruce.e.zhao@gmail.com
# FILE: my.sh
# ROLE: TODO (some explanation)
# CREATED: 2016-10-18 19:27:58
# MODIFIED: 2016-10-18 21:45:23
path=/home/eagle/Pictures/background
files=`ls -U $path`
last_file='empty'
echo '<background>'
echo ' <starttime>'
echo ' <year>2009</year>'
echo ' <month>08</month>'
echo ' <day>04</day>'
echo ' <hour>00</hour>'
echo ' <minute>00</minute>'
echo ' <second>00</second>'
echo ' </starttime>'
for current_file in $files
do
if [[ $last_file == 'empty' ]]
then
last_file=$current_file
echo ' <static>'
echo ' <duration>295.0</duration>'
echo " <file>$path/$last_file</file>"
echo ' </static>'
else
echo ' <transition>'
echo ' <duration>5.0</duration>'
echo " <from>$path/$last_file</from>"
echo " <to>$path/$current_file</to>"
echo ' </transition>'
echo ' <static>'
echo ' <duration>295.0</duration>'
echo " <file>$path/$current_file</file>"
echo ' </static>'
last_file=$current_file
fi
done
echo '</background>'
eagle@eagle-com:~$ chmod 755 background.sh
eagle@eagle-com:~$ ./background.sh > mybackground.xml
eagle@eagle-com:~$ vim /usr/share/gnome-background-properties/xenial-wallpapers.xml
<wallpaper deleted="false">
<name>mybackground</name>
<filename>/home/eagle/Pictures/mybackground.xml</filename>
<options>zoom</options>
</wallpaper>
即在该文件中添上上面5句话,<name>标签中可随意起一个名字。<filename>标签为xml文件的地址。
之后在背景里选择与<name>标签下名字相同的即可。