[转] ubuntu Linux/Mint 下实现动态桌面壁纸 de 原理

不知大家在使用ubuntu时有没有注意到,ubuntu下是可以实现多张壁纸动态切换的,好像Win7下也有类似的功能(曾经使用win7一段时间)。我也是最近才注意到这点,下面是在ubuntu10.04下实验的,之前版本的应该也可以。 
实现原理是使用一个xml文件来记录可供切换选择的壁纸。下面展示的是10.04中自带的一个样例。 
首先说明一下,ubuntu默认的壁纸存放在/usr/share/backgrounds/目录下的,在该目录中还有一个cosmos(意思是“宇宙”)目录,cosmos里面的xml文件就是实现动态桌面壁纸切换功能的了。 
 
jarson@jarson-laptop:/usr/share/backgrounds/cosmos$ ls 
background-1.xml      cloud.jpg  earth-horizon.jpg   helix-nebula.jpg  sombrero.jpg 
blue-marble-west.jpg  comet.jpg  galaxy-ngc3370.jpg  jupiter.jpg       whirlpool.jpg 
jarson@jarson-laptop:/usr/share/backgrounds/cosmos$ cat background-1.xml  
 
    starttime标签设置动画(幻灯片)开始的时间,可根据自己制作的时间设定,这个应该不影响实际要实现的功能 
    2009 
    08 
    04 
    00 
    00 
    00 
   
   "animation"动画的意思 
   "static"静态的意思 
    1800.0  duration标签设置持续的时间,以秒为单位。 
    /usr/share/backgrounds/cosmos/cloud.jpg  file标签指定壁纸存放的路径 
   
   "transition"切换的意思 
    5.0 
    /usr/share/backgrounds/cosmos/cloud.jpg from ... to从壁纸A切换到壁纸B。 
    /usr/share/backgrounds/cosmos/comet.jpg 
   
   
    1800.0 
    /usr/share/backgrounds/cosmos/comet.jpg 
   
   
    5.0 
    /usr/share/backgrounds/cosmos/comet.jpg 
    /usr/share/backgrounds/cosmos/earth-horizon.jpg 
   
   
    1800.0 
    /usr/share/backgrounds/cosmos/earth-horizon.jpg 
   
   
    5.0 
    /usr/share/backgrounds/cosmos/earth-horizon.jpg 
    /usr/share/backgrounds/cosmos/blue-marble-west.jpg 
   
   
    1800.0 
    /usr/share/backgrounds/cosmos/blue-marble-west.jpg 
   
   
    5.0 
    /usr/share/backgrounds/cosmos/blue-marble-west.jpg 
    /usr/share/backgrounds/cosmos/galaxy-ngc3370.jpg 
   
   
    1800.0 
    /usr/share/backgrounds/cosmos/galaxy-ngc3370.jpg 
   
   
    5.0 
    /usr/share/backgrounds/cosmos/galaxy-ngc3370.jpg 
    /usr/share/backgrounds/cosmos/helix-nebula.jpg 
   
   
    1800.0 
    /usr/share/backgrounds/cosmos/helix-nebula.jpg 
   
   
    5.0 
    /usr/share/backgrounds/cosmos/helix-nebula.jpg 
    /usr/share/backgrounds/cosmos/jupiter.jpg 
   
   
    1800.0 
    /usr/share/backgrounds/cosmos/jupiter.jpg 
   
   
    5.0 
    /usr/share/backgrounds/cosmos/jupiter.jpg 
    /usr/share/backgrounds/cosmos/sombrero.jpg 
   
   
    1800.0 
    /usr/share/backgrounds/cosmos/sombrero.jpg 
   
   
    5.0 
    /usr/share/backgrounds/cosmos/sombrero.jpg 
    /usr/share/backgrounds/cosmos/whirlpool.jpg 
   
   
    1800.0 
    /usr/share/backgrounds/cosmos/whirlpool.jpg 
   
   
    5.0 
    /usr/share/backgrounds/cosmos/whirlpool.jpg 
    /usr/share/backgrounds/cosmos/cloud.jpg 
   
 
注意from ... to要构成一个循环。 
设置动态桌面壁纸有两个好的功能:1、满足自己设置多张壁纸的需要;2、时间提醒,例如我这里设置半小时切换一次,这样每次桌面变换时,我就会知道半个小时又过去了。。。 
 
设置好后的应用方法:右键桌面->更改桌面背景->添加,在弹出对话框的右下方那里选择“全部文件”(默认是“图像”),然后找到你定义好的动态桌面壁纸的xml文件,双击添加就可以了。 

转载于:https://my.oschina.net/Qunero/blog/8599

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值