百度空间 | 百度首页 
 
查看文章
 
[分享]桌面倒计时小shell--实用
2009年11月07日 星期六 下午 07:11
不能算原创,这个是根据一个天气预报的shell改的.功能嘛就是把文字嵌入了壁纸,然后每日自动更新.
效果如下图:
-----------------------------------------------------------------------------------------------------------------------------------



代码如下:
=======================================================
#!/bin/bash
#Copyright (c) 2009 casio date counter desktop
#Name desktop date counter
#License: GPLv3
#Version 20091107

#天气图标的位置
Icondir="`dirname $0`/icons"
#欲用作背景的图片
BackPic="$Icondir/background.jpg"
#最终输出的图片位置
OutPic="$Icondir/wallpapertmp.png"
#最终输出图片复本
Final_Pic="/home/casio/picture/wallpaper/kaoyan.png"
#文字的字体,若不是中文字体则中文可能无法正常显示
Font="/usr/share/fonts/truetype/wqy/wqy-zenhei.ttf"
#文字的大小
FontSize=30
#文字的颜色
TxtColor="white"
#文字信息绘制的位置
TxtPosX=1000
TxtPosY=250
#隔多大距离绘制下一行(此距离包括本行的宽度)
TxtYIncr=35


Count_Day="$((`date +%s -d "2010-01-08"`-`date +%s`))"
number=`expr $Count_Day / 86400`
convert -font $Font -fill $TxtColor -pointsize $FontSize \
-draw "text $TxtPosX,$TxtPosY '考研仅剩$number天!'" $BackPic $OutPic

cp $OutPic $Final_Pic

gconftool-2 -s /desktop/gnome/background/picture_filename --type=string "$Final_Pic"

=======================================================
希望能方便大家

类别:linux-shell | 添加到搜藏 | 浏览() | 评论 (0)
 
最近读者:
 
网友评论:
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码: 请点击后输入四位验证码,字母不区分大小写
      

     

©2009 Baidu