美文网首页
ubuntu 中设置动态壁纸

ubuntu 中设置动态壁纸

作者: 忆斐 | 来源:发表于2018-03-30 14:39 被阅读0次

为了开发android 功能,ubuntu系统也使用了好久时间,作为一个经常使用的系统,不捣鼓捣鼓就太平淡,根据网上的一些介绍,搞了一个动态壁纸出来,用来定时更换壁纸。

首先创建一个文件夹,里面三个文件,其余根据自己喜好放入壁纸文件。


第一个文件addbackground.sh,需要可执行权限

sudo rm -rf /usr/share/backgrounds/test
sudo mkdir /usr/share/backgrounds/test
sudo cp  *.jpg /usr/share/backgrounds/test/
. makelist.sh > background.xml
sudo cp background.xml /usr/share/backgrounds/test/
sudo cp cust-wallpapers.xml /usr/share/gnome-background-properties/

gsettings set org.gnome.desktop.background picture-uri 'file:///usr/share/backgrounds/test/background.xml'

第二个文件,用于拷贝到gnome-background-properties,这样设置里面就可以选择作为动态壁纸

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
<wallpapers>
 <wallpaper deleted="false">
   <name>wentao wallpaper</name>
   <filename>/usr/share/backgrounds/test/background.xml</filename>
   <options>zoom</options>
 </wallpaper>
</wallpapers>

第三个文件makelist.sh 也需要可执行权限

#!/bin/bash
# wentao add 2017.6.27

#get current path
basepath=$(cd `dirname $0`; pwd)

#get all jpg wallpapers
files=`ls  $basepath |grep jpg`

lastfile='empty'

echo '<background>'
echo '    <starttime>'
echo '        <year>2017</year>'
echo '        <month>3</month>'
echo '        <day>15</day>'
echo '        <hour>00</hour>'
echo '        <minute>00</minute>'
echo '        <second>00</second>'
echo '    </starttime>'

for current_file in $files
do
        if [[ $lastfile == 'empty' ]]
        then
                lastfile=$current_file
                echo '    <static>'
                echo '        <duration>300.0</duration>'
                echo "       <file>/usr/share/backgrounds/test/$lastfile</file>"
                echo '    </static>'
        else
                echo '    <transition>'
                echo '         <duration>5.0</duration>'
                echo "         <from>/usr/share/backgrounds/test/$lastfile</from>"
                echo "         <to>/usr/share/backgrounds/test/$current_file</to>"
                echo '    </transition>'
                echo '    <static>'
                echo '         <duration>300.0</duration>'
                echo "        <file>/usr/share/backgrounds/test/$current_file</file>"
                echo '    </static>'
                lastfile=$current_file
        fi
done

echo '</background>'

设置完成以后,运行 ./addbackgroundd.sh,就可以设置动态壁纸了,如果想更换动态壁纸里的图片,只要更新当前文件夹里面的图片就可以了。

相关文章

  • ubuntu 中设置动态壁纸

    为了开发android 功能,ubuntu系统也使用了好久时间,作为一个经常使用的系统,不捣鼓捣鼓就太平淡,根据网...

  • 动态壁纸食用指南

    目前手机/电脑基本不支持动态壁纸直接设置(仅少数手机品牌支持),动态壁纸设置需要借助第三方软件。 我的壁纸上传的平...

  • Android动态壁纸预览设置

    最近做动态壁纸项目,需要设置在自己的App上设置动态壁纸。自己查找百度(我查到最后还是没查到,差评!差评!差评!)...

  • 很蠢很蠢的动态壁纸设置

    x的时代 直接抖音导出动态壁纸,设置-壁纸 设置即可 iphone 7p时代步骤如下: 导入livephoto为壁...

  • 5K国际空间站高清动态壁纸

    5K国际空间站高清动态壁纸 想要设置动态壁纸?小编将这套精美的5k国际空间站高清动态壁纸分享给大家,这是一套时刻壁...

  • 动漫史蒂文宇宙动态桌面壁纸

    今天小编为朋友们带来一款动漫史蒂文宇宙动态桌面壁纸,可以完美设置为电脑动态壁纸,非常美观。壁纸会随着时间的变化而变...

  • 抖音如何下载插件 抖音插件下载教程

    在抖音短视频上看到喜欢的视频可以将其直接设置为动态壁纸啦,让你的壁纸活起来,但是设置抖音壁纸需要先下载抖音插件安装...

  • 【Mac动态壁纸】太空地球3k动态壁纸

    想要为你的桌面设置动态壁纸吗?未来软件园为大家提供Earth iss地球动态壁纸。这是一个酷炫的地球动态桌面3k时...

  • Ubuntu16.04动态静态ip设置

    Ubuntu16.04 动态静态ip设置 1. 动态ip设置(eth0是网卡名称) 2. 静态ip设置(eth0是...

  • 如何将抖音上的视频设置成为你的动态壁纸

    抖音上有很多漂亮唯美的动态壁纸和视频,怎样能把他们设置成为我们自己的手机的动态壁纸呢? 其实很简单。 第一步,先点...

网友评论

      本文标题:ubuntu 中设置动态壁纸

      本文链接:https://www.haomeiwen.com/subject/jqkicftx.html