ubuntu下實現動態桌面壁紙
不知大家在使用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
<background>
<starttime> starttime標籤設置動畫(幻燈片)開始的時間,可根據自己製作的時間設定,這個應該不影響實際要實現的功能
<year>2009</year>
<month>08</month>
<day>04</day>
<hour>00</hour>
<minute>00</minute>
<second>00</second>
</starttime>
<!-- This animation will start at midnight. --> "animation"動畫的意思
<static> "static"靜態的意思
<duration>1800.0</duration> duration標籤設置持續的時間,以秒爲單位。
<file>/usr/share/backgrounds/cosmos/cloud.jpg</file> file標籤指定壁紙存放的路徑
</static>
<transition> "transition"切換的意思
<duration>5.0</duration>
<from>/usr/share/backgrounds/cosmos/cloud.jpg</from> from ... to從壁紙A切換到壁紙B。
<to>/usr/share/backgrounds/cosmos/comet.jpg</to>
</transition>
<static>
<duration>1800.0</duration>
<file>/usr/share/backgrounds/cosmos/comet.jpg</file>
</static>
<transition>
<duration>5.0</duration>
<from>/usr/share/backgrounds/cosmos/comet.jpg</from>
<to>/usr/share/backgrounds/cosmos/earth-horizon.jpg</to>
</transition>
<static>
<duration>1800.0</duration>
<file>/usr/share/backgrounds/cosmos/earth-horizon.jpg</file>
</static>
<transition>
<duration>5.0</duration>
<from>/usr/share/backgrounds/cosmos/earth-horizon.jpg</from>
<to>/usr/share/backgrounds/cosmos/blue-marble-west.jpg</to>
</transition>
<static>
<duration>1800.0</duration>
<file>/usr/share/backgrounds/cosmos/blue-marble-west.jpg</file>
</static>
<transition>
<duration>5.0</duration>
<from>/usr/share/backgrounds/cosmos/blue-marble-west.jpg</from>
<to>/usr/share/backgrounds/cosmos/galaxy-ngc3370.jpg</to>
</transition>
<static>
<duration>1800.0</duration>
<file>/usr/share/backgrounds/cosmos/galaxy-ngc3370.jpg</file>
</static>
<transition>
<duration>5.0</duration>
<from>/usr/share/backgrounds/cosmos/galaxy-ngc3370.jpg</from>
<to>/usr/share/backgrounds/cosmos/helix-nebula.jpg</to>
</transition>
<static>
<duration>1800.0</duration>
<file>/usr/share/backgrounds/cosmos/helix-nebula.jpg</file>
</static>
<transition>
<duration>5.0</duration>
<from>/usr/share/backgrounds/cosmos/helix-nebula.jpg</from>
<to>/usr/share/backgrounds/cosmos/jupiter.jpg</to>
</transition>
<static>
<duration>1800.0</duration>
<file>/usr/share/backgrounds/cosmos/jupiter.jpg</file>
</static>
<transition>
<duration>5.0</duration>
<from>/usr/share/backgrounds/cosmos/jupiter.jpg</from>
<to>/usr/share/backgrounds/cosmos/sombrero.jpg</to>
</transition>
<static>
<duration>1800.0</duration>
<file>/usr/share/backgrounds/cosmos/sombrero.jpg</file>
</static>
<transition>
<duration>5.0</duration>
<from>/usr/share/backgrounds/cosmos/sombrero.jpg</from>
<to>/usr/share/backgrounds/cosmos/whirlpool.jpg</to>
</transition>
<static>
<duration>1800.0</duration>
<file>/usr/share/backgrounds/cosmos/whirlpool.jpg</file>
</static>
<transition>
<duration>5.0</duration>
<from>/usr/share/backgrounds/cosmos/whirlpool.jpg</from>
<to>/usr/share/backgrounds/cosmos/cloud.jpg</to>
</transition>
</background>
注意from ... to要構成一個循環。
設置動態桌面壁紙有兩個好的功能:1、滿足自己設置多張壁紙的需要;2、時間提醒,例如我這裏設置半小時切換一次,這樣每次桌面變換時,我就會知道半個小時又過去了。。。
設置好後的應用方法:右鍵桌面->更改桌面背景->添加,在彈出對話框的右下方那裏選擇“全部文件”(默認是“圖像”),然後找到你定義好的動態桌面壁紙的xml文件,雙擊添加就可以了。
實現原理是使用一個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
<background>
<starttime> starttime標籤設置動畫(幻燈片)開始的時間,可根據自己製作的時間設定,這個應該不影響實際要實現的功能
<year>2009</year>
<month>08</month>
<day>04</day>
<hour>00</hour>
<minute>00</minute>
<second>00</second>
</starttime>
<!-- This animation will start at midnight. --> "animation"動畫的意思
<static> "static"靜態的意思
<duration>1800.0</duration> duration標籤設置持續的時間,以秒爲單位。
<file>/usr/share/backgrounds/cosmos/cloud.jpg</file> file標籤指定壁紙存放的路徑
</static>
<transition> "transition"切換的意思
<duration>5.0</duration>
<from>/usr/share/backgrounds/cosmos/cloud.jpg</from> from ... to從壁紙A切換到壁紙B。
<to>/usr/share/backgrounds/cosmos/comet.jpg</to>
</transition>
<static>
<duration>1800.0</duration>
<file>/usr/share/backgrounds/cosmos/comet.jpg</file>
</static>
<transition>
<duration>5.0</duration>
<from>/usr/share/backgrounds/cosmos/comet.jpg</from>
<to>/usr/share/backgrounds/cosmos/earth-horizon.jpg</to>
</transition>
<static>
<duration>1800.0</duration>
<file>/usr/share/backgrounds/cosmos/earth-horizon.jpg</file>
</static>
<transition>
<duration>5.0</duration>
<from>/usr/share/backgrounds/cosmos/earth-horizon.jpg</from>
<to>/usr/share/backgrounds/cosmos/blue-marble-west.jpg</to>
</transition>
<static>
<duration>1800.0</duration>
<file>/usr/share/backgrounds/cosmos/blue-marble-west.jpg</file>
</static>
<transition>
<duration>5.0</duration>
<from>/usr/share/backgrounds/cosmos/blue-marble-west.jpg</from>
<to>/usr/share/backgrounds/cosmos/galaxy-ngc3370.jpg</to>
</transition>
<static>
<duration>1800.0</duration>
<file>/usr/share/backgrounds/cosmos/galaxy-ngc3370.jpg</file>
</static>
<transition>
<duration>5.0</duration>
<from>/usr/share/backgrounds/cosmos/galaxy-ngc3370.jpg</from>
<to>/usr/share/backgrounds/cosmos/helix-nebula.jpg</to>
</transition>
<static>
<duration>1800.0</duration>
<file>/usr/share/backgrounds/cosmos/helix-nebula.jpg</file>
</static>
<transition>
<duration>5.0</duration>
<from>/usr/share/backgrounds/cosmos/helix-nebula.jpg</from>
<to>/usr/share/backgrounds/cosmos/jupiter.jpg</to>
</transition>
<static>
<duration>1800.0</duration>
<file>/usr/share/backgrounds/cosmos/jupiter.jpg</file>
</static>
<transition>
<duration>5.0</duration>
<from>/usr/share/backgrounds/cosmos/jupiter.jpg</from>
<to>/usr/share/backgrounds/cosmos/sombrero.jpg</to>
</transition>
<static>
<duration>1800.0</duration>
<file>/usr/share/backgrounds/cosmos/sombrero.jpg</file>
</static>
<transition>
<duration>5.0</duration>
<from>/usr/share/backgrounds/cosmos/sombrero.jpg</from>
<to>/usr/share/backgrounds/cosmos/whirlpool.jpg</to>
</transition>
<static>
<duration>1800.0</duration>
<file>/usr/share/backgrounds/cosmos/whirlpool.jpg</file>
</static>
<transition>
<duration>5.0</duration>
<from>/usr/share/backgrounds/cosmos/whirlpool.jpg</from>
<to>/usr/share/backgrounds/cosmos/cloud.jpg</to>
</transition>
</background>
注意from ... to要構成一個循環。
設置動態桌面壁紙有兩個好的功能:1、滿足自己設置多張壁紙的需要;2、時間提醒,例如我這裏設置半小時切換一次,這樣每次桌面變換時,我就會知道半個小時又過去了。。。
設置好後的應用方法:右鍵桌面->更改桌面背景->添加,在彈出對話框的右下方那裏選擇“全部文件”(默認是“圖像”),然後找到你定義好的動態桌面壁紙的xml文件,雙擊添加就可以了。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.