ubuntu 16.04 实现自动换壁纸 幻灯片

参考:


http://blog.sina.com.cn/s/blog_702c2db50100pkcv.html

http://www.cnblogs.com/youxia/p/linux030.html



1.首先生成xml文件,shell脚本放在壁纸文件夹内:

#!/bin/sh
#xml文件名
xmlname="background-new.xml"
#壁纸目录
dir="/home/stm/图片/wallPaper/"
#持续时间
conTime=1795
#切换时间
chaTime=5

if [ ! -d $dir ];then
  echo "error: $dir is not a dir!\b"
  exit 0
fi
xmlname=${dir}${xmlname}
if [ -f $xmlname ];then
  rm $xmlname
  if [ ! $? -eq 0 ]; then
echo "error: $xmlname cant romove!\n"
exit 0
  fi
fi
echo "\
  \n\
  \n\
    2009\n\
    08\n\
    04\n\
    00\n\
    00\n\
    00\n\
  \n\
\n" >> $xmlname
count=0
firstfile = ""
for file in `ls ${dir}*.jpg`
do
  count=`expr $count + 1`
  filename="$file"


  if [ ! $count -eq 1 ];then                      
    echo "\
    ${filename}\n\
    \n" >> $xmlname
  else
    firstfile="$file"
  fi
  echo "\
    \
        ${conTime}\n\
         ${filename}\n\
    \n\
    \n\
        ${chaTime}\n\
        ${filename}\n" >> $xmlname
  echo "$count $filename done\n"
done


echo "\
${firstfile}\n" >> $xmlname


echo "\n" >> $xmlname
echo "xml file make done\n"


运行后得到一个xml文件


2.修改第二个文件

第二个文件位于/usr/share/gnome-background-properties/下的xenial-wallpapers.xml

按照格式将自己的xml文件地址添加上去,就可以在系统桌面里看到自己的配置了

ubuntu 16.04 实现自动换壁纸 幻灯片_第1张图片


另外,主题的安装参考了http://www.jcodecraeer.com/a/chengxusheji/chengxuyuan/2015/0923/3502.html

https://blog.anmoljagetia.me/flatabulous-ubuntu-theme/

你可能感兴趣的:(学习笔记)