美女时钟(shell)
想不想让你的桌面好看还有时钟,那赶快来试试吧,美女桌面时钟为你带来良好的视觉享受。每分钟都有美女为你报时。编写一个脚本
#!/bin/bash #Author: LinuxSong #Blog: http://www.linuxsong.org gconftool=`which gconftool-2` if [ ! -x"$gconftool" ]; then echo 没有找到 exit 1 fiimagePath=/tmp/sodao if [ ! -d "$imagePath" ]; then mkdir -p $imagePath if [ ! -d "$imagePath" ]; then echo 创建[$imagePath]目录失败 exit 1 fifiurl="http://www.sodao.com/app/ShowTime/gt?pcs_id=1&size=3"#下面这个地址是青岛版,上面那个是杭州的 #url="http://www.sodao.com/app/ShowTime/gt1?pcs_id=9&size=3" while [ true ] do imgUrl=`curl --connect-timeout 20 --retry 2 -s $url|awk -F, '{print $5}' | awk -F\" '{print $4}'` if [ -n "$imgUrl" ]; then fileName=`echo $imgUrl | awk -F\/ '{print $NF}'` if [ -f "$imagePath/$fileName" -a "$fileName" = "$lastName" ];then continue fi curl --connect-timeout 20 --retry 2 -s $imgUrl -o $imagePath/$fileName if [ ! -f "$imagePath/$fileName" ]; then echo 获取[$imgUrl]失败 continue fi $gconftool -s /desktop/gnome/background/picture_filename -t string "$imagePath/$fileName" -s/desktop/gnome/background/picture_options zoom lastName=$fileName fi sleep 1 done 把上面的脚本复制到你的机器上,执行一下,你的桌面就会每分钟更换一个美女为你报时。不过要注意只能在GNOME环境下用,因为我的系统中只装了GNOME环境,KDE的用户只要把设置桌面的命令改成KDE下设置桌面的命令即可。
有了上面的脚本,我们就可以加入开机自动启动。加在rc.local和 crontab是不行的,因为gconftool-2依赖于很多GNOME桌面环境变量,而有些变量是每次启动图形都不一样。不过GNOME是支持自动启动配置程序的,方法如下:
在$HOME/.config/autostart目录中新建一个文件:
Version=1.0
Encoding=UTF-8
Name=wallpaper
Type=Application
Exec=/home/linuxsong/wallpaper.sh
Terminal=false
Comment=Girl wallpaper
Categories=Utility;
X-Desktop-File-Install-Version=0.15
Hidden=false
把Exec=/home/linuxsong/wallpaper.sh这句中的路径改成你自己的路径即可。
重新注销一下看看你的桌面,是不是有美女为你报时?
页:
[1]