[轉] 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要構成一個循環。
設置動態桌面壁紙有兩個好的功能:一、知足本身設置多張壁紙的須要;二、時間提醒,例如我這裏設置半小時切換一次,這樣每次桌面變換時,我就會知道半個小時又過去了。。。
設置好後的應用方法:右鍵桌面->更改桌面背景->添加,在彈出對話框的右下方那裏選擇「所有文件」(默認是「圖像」),而後找到你定義好的動態桌面壁紙的xml文件,雙擊添加就能夠了。
歡迎關注本站公眾號,獲取更多信息