你是否厌倦了一直同一张壁纸,让linux自动换去吧
下面贴脚本
其实shotwell 可以实现,但是这个软件在生成xml文件时 占用cpu太高,而且很慢,且自定义不强
果断shell脚本
但是gnome-shell 内存占有率很高,建议transition 为默认无
#! /bin/bash
# <transition type="fade"> <transition type="overlay">
# files=`ls $path | sort -n` 还是按照字典序排列 比如 A99 A9 所以 ls -sort
# 或者随机照片 sort -R
# '' 单引号中不可引用 $xxx "" 双引号中可以引用 $xxx
#files=`ls -sort $path | awk '{print $9}' `
#files=`ls -sort $path | awk '{print $9}' | tail -40`
# 只需要指定参数 第一个路径需要带 xxx/
# 直接重定向到wallpaper.xml 然后需要修改最后一行的有点问题转换到哪一个
# 只取了后40个文件,可以修改
# changeWallpaper Music/ > wallpaper.xml
path=/home/zl/$1
#files=`ls $path | sort -n`
files=`ls $path | sort -n | tail -40`
last_file='empty'
echo '<background>'
for current_file in $files
do
if [[ $last_file == 'empty' ]]
then
last_file=$current_file
echo ' <static>'
echo ' <duration>180.00</duration>'
echo " <file>$path$last_file</file>"
echo ' </static>'
else
echo ' <transition type="overlay">'
echo ' <duration>5.0</duration>'
echo " <from>$path$last_file</from>"
echo " <to>$path$current_file</to>"
echo ' </transition>'
echo ' <static>'
echo ' <duration>180.00</duration>'
echo " <file>$path$current_file</file>"
echo ' </static>'
last_file=$current_file
fi
done
#first_file=`ls -sort $path | awk '{print $9}' | head -2 | sed '/^$/d'`
first=`ls $path | sort -n | head -1`
echo ' <transition type="overlay">'
echo ' <duration>5.0</duration>'
echo " <from>$path$last_file</from>"
echo " <to>$path$first</to>"
echo ' </transition>'
echo '</background>'