ºìÁªLinuxÃÅ»§
Linux°ïÖú

×ÀÃæÃÀ»¯----conkyÅäÖÃ

·¢²¼Ê±¼ä:2012-04-23 22:17:03À´Ô´:ºìÁª×÷Õß:zyzhang12
[i=s] ±¾Ìû×îºóÓÉ zyzhang12 ÓÚ 2012-4-23 22:18 ±à¼­ [/i]

[attach]37719[/attach]
[attach]37718[/attach] [attach]37720[/attach]

ConkyÊÇÒ»¸ö½¨ÉèÔÚX-windowÖ®ÉϵÄϵͳ¼àÊÓ¹¤¾ß£¬ËüÕ¼ÓÃϵͳ×ÊÔ´·Ç³£Ð¡¶ø¹¦ÄÜÈ´·Ç³£Ç¿´ó£¬Èç¹ûÄ㶮µÃshell±à³Ì£¬ÄÇôconkyµÄ¹¦ÄÜ¿É
ÒÔ˵ÊÇÎÞËù²»ÄÜÁË¡£Í¬Ê±£¬ConkyÊÇÔÚ¸ù´°¿ÚÉÏ»æÖƽçÃ棬Òò´Ë±¾Éí¾ÍÖ§³Ö͸Ã÷£¬¿ÉÒÔºÍ×ÀÃæÍêÃÀµØ½áºÏÔÚÒ»Æð£¬Èç¹ûÄãÔ¸Ò⣬ConkyÒ²¿ÉÒÔÒÔ´°¿ÚµÄÐÎʽ
ÔËÐС£
µ±È»£¬¼´Ê¹Äã²»¶®shell£¬¸ù¾ÝÏÂÃæµÄ½Ì³Ì£¬ÄãÒ²ÄÜÒ»²½²½Ñ§»áʹÓÃconkey¡£
1¡¢»ñÈ¡conky¡£
[mw_shl_code=shell,true]sudo apt-get install conky[/mw_shl_code]
2¡¢ÅäÖÃconky
Conky °²×°ºó²»»áΪµ±Ç°Óû§´´½¨ÅäÖÃÎļþ£¬¶øÊÇʹÓÃϵͳ¼¶Ä¬ÈÏÅäÖÃÎļþ£¬ÕâʱºòÐèҪʹÓÃÏÂÁÐÃüÁîÊÖ¶¯Éú³Éµ±Ç°Óû§µÄÅäÖÃ
[mw_shl_code=shell,true]zcat /usr/share/doc/conky/examples/conkyrc.sample.gz > ~/.conkyrc[/mw_shl_code]
µ« Conky ĬÈϵÄÅäÖÃÒ²Ðí²¢²»ÄÜÂú×ãÎÒÃǵÄÐèÒª£¬¿ÉÒÔ¸ù¾Ý×Ô¼ºµÄÐèҪȥµôÁËһЩ²»ÊʺϵÄÔªËØ£¬Ôö¼ÓÁ˼¸¸öÐèÒªµÄ²ÎÊý¡£
Ê×ÏÈ£¬ConkyµÄÅäÖÃÎļþ·ÖΪÁ½¸ö²¿·Ö£¬µÚÒ»²¿·Ö¶ÔConkyµÄÈ«¾ÖÊôÐÔ×öÉ趨£¬±ÈÈç×ÖÌ塢ǶÈë×ÀÃæµÈµÈ£»µÚ¶þ²¿·ÖÊǶ¨ÒåConkyµÄÊä³ö¸ñʽ£¬Ò²¾ÍÊÇConky³ÊÏÖÔÚ×ÀÃæÉϵÄÑùʽ¡£
background no£ºÊÇ·ñǶÈë×ÀÃ棬¡°no¡±±íʾ²»Ç¶È룻¡°yes¡±±íʾǶÈë¡£
use_xft yes£ºÊÇ·ñʹÓÃxft×ÖÌ壨ȫ¾Ö×ÖÌ壩£¬Ò»°ãΪ¡°yes¡±¡£
¶¨Òå×ÖÌ壺ʹÓà xftfont ÎÂȪæä΢Ã׺Ú:size=8 ÕâÐпÉÒÔ¶¨Òå Conky µÄÈ«¾Ö×ÖÌ壬Æä¸ñʽΪ×ÖÌåÃû³Æ:´óС£¬Ò²¿ÉʹÓÃ×ÖÌåÑùʽ£¬Èç´ÖÌå¿ÉÓà style=Bold À´±íʾ¡£
out_to_console no£ºÊÇ·ñÊä³ö½á¹ûµ½Öնˣ¬Ö÷ÒªÔÚÅжÏConkyÔÚÄÄÀï³ö´íʱʹÓã¬Ò»°ãÇé¿öÏÂΪ¡°no¡±¼´¿É¡£
ÏÔʾλÖ㺠gap_y 10£ºÒÔÉÏÁ½ÌõÉ趨ConkyÊä³ö·¶Î§¾àÀëÆÁÄ»±ß½çµÄÏñËØÊýÁ¿£¬×îСΪ10ÏñËØ¡£ alignment top_right£ºÉ趨ConkyÊä³ö·¶Î§ÔÚÆÁÄ»ÉϵÄλÖ㬡°top_right¡±±íʾÓÒÉÏ·½£¬ÒÀ´ËÀàÍÆ£¬¡°bottom_left¡±ÊÇ×óϽǡ£
´óС¼°±ß¿ò£º·Ö±ðÓÉ minimum_size ºÍ border_width À´È·¶¨£¬Ç°ÕßµÄÉèÖøñʽΪ¿íx¸ß£¬²»Òª±ß¿òµÄ»°£¬¿É½«ºóÕßÉèÖÃΪ 0¡£Èçminimum_size 280 5£ºÉ趨ConkyµÄ±ß½ç·¶Î§£¬×îС¿í¶ÈΪ280ÏñËØ£¬×îС¸ß¶ÈΪ5ÏñËØ¡£maximum_width 308£ºConky±ß½ç·¶Î§×î´ó¿í¶È308ÏñËØ£¬ºÜ¶àʱºòÓÃÕâ¸ö²ÎÊýÀ´ÏÞÖÆConkyµÄ±ß½ç¡£
ÏÔʾÐÅÏ¢£ºÔÚ Conky ÅäÖÃÎļþµÄ×îºó²¿·Ö¿ÉÒÔ¶¨Òå¾ßÌåÏÔʾʲôÄÚÈÝ¡£ÕâÀïÖ÷ÒªÊÇÁ˽âһЩ±äÁ¿µÄʹÓ㬱ÈÈ磬ÏÔʾϵͳ´Ó¿ª»úµ½ÏÖÔÚËùÔËÐеÄ×ܹ²Ê±¼ä£¬¿ÉÒÔʹÓà uptime ±äÁ¿£¬±äÁ¿Ç°ÃæÒªÓà $ ±íʾ¡£¸ü¶à±äÁ¿µÄº¬Òå¿ÉÒԲ鿴 Conky Ö÷Ò³µÄ Conky Variables¡£
update_interval 1£ºË¢ÐÂʱ¼ä¡£ConkyÐèҪÿ¸ôÒ»¶Îʱ¼ä¶ÁÈ¡Ò»´ÎÒª¼àÊÓµÄϵͳ״̬²¢°Ñ½á¹ûÊä³öµ½ÆÁÄ»ÉÏ£¬É趨µÄʱ¼ä¼ä¸ôÔ½¶Ì£¬¼à¿ØµÄʵʱÐÔÔ½ºÃ£¬µ«ÏµÍ³¸ºµ£Ò²Ô½ÖØ£»¼ä¸ôʱ¼äÔ½³¤Ôòϵͳ¸ºµ£Ô½Çᣬµ«ÊǼà¿ØµÄʵʱÐÔÔ½²î¡£ÎÒÕâÀïÉ趨Ϊ1Ãë¡£
ʹÓÃÎÂȪæä×÷È«¾Ö×ÖÌåµÄºÃ´¦¾ÍÊÇ ¿ÉÒÔ·ÀÖ¹ÖÐÎÄÂÒÂë¡£Èç¹ûÄãÔÚÅäÖúÃÖ®ºó·¢Ïֺܶà¿Ú¿Ú£¬ÄǾÍÊÇ×ÖÌåÉèÖóö´íÁË£¬¸ü¸ÄÒÔ${font ¿ªÍ· ºóÃæµÄ×ÖÌåÑùʽ¿ÉÒÔ½â¾öÂÒÂëÎÊÌâ¡£²»¹ýºÜÒź¶µÄ·¢ÏÖÔÚlinuxµÄÖÐÎÄ×ÖÌåÖкÜÉÙ Ö§³ÖÌØÊâ×Ö·ûµÄ£¬±ÈÈç¡æ¡£ÓÉÓÚÕâ¸öÔ­ÒòÔÚºóÃ棬ÎÒÅäÖÃÌìÆøÀïÀË·ÑÁ˲»ÉÙ¹¦·ò¡£

ConkyÑùʽ¶¨ÒåµÄÓï·¨ºÍ±àдÍøÒ³ÓеãÏàËÆ£¬Ê×ÏÈ£¬ÒÔ×Ö·û¡°TEXT¡±±êÖ¾Ñùʽ¶¨ÒåµÄ¿ªÊ¼¡£ConkyÑùʽµÄ¶¨ÒåÒÔÐÐΪµ¥Î»£¬Ã¿Ò»ÐжÔÓ¦ConkyÊä³öµ½ÆÁĻʱµÄÒ»ÐС£ ÿһÐпÉÒÔ·ÖΪÑùʽÊôÐÔ¡¢ÎÄ×ÖºÍÔªËØ¡£ÆäÖÐÑùʽÊôÐÔºÍÔªËض¼ÒÔ¡°$¡±¿ªÍ·£¬²¢°üº¬ÔÚ¡°{}¡±ÀïÃ棬¡°${}¡±Ó¦¸Ã·ÅÔÚÓ¦ÓÃÄ¿±êµÄÇ°Ãæ¡£
ÑùʽÊôÐÔÈçÑÕÉ«¡¢×ÖÌå´óС¡¢Í£¿¿Î»Öõȣ¬ÆäÖУ¬ÑÕÉ«µÄ¶¨Òå¸ñʽΪ£º${color #5000a0}
ÆäÖеÄ16λֵɫ¿ÉÒÔÓÃXÖж¨ÒåµÄÑÕÉ«Ãû³Æ´úÌ棬È磺${color snow}
Äã¿ÉÒÔÔÚ/etc/X11/rgb.txtÖÐÕÒµ½È«²¿ÑÕÉ«µÄÁÐ±í¡£
×ÖÌåÊôÐԵĶ¨Òå¸ñʽÈçÏ£º${font Monospace:style=Bold:size=10}
ÉÏÃæÈý¸ö×ÖÌåÊôÐÔÖÐÈκÎÒ»¸ö²»É趨ÔòʹÓÃÉÏÃ涨ÒåµÄĬÈÏÖµ¡£
${alignr}±íʾÒԸòÎÊý¶¨ÒåµÄÔªËØÏòÓÒ¶ÔÆ룬${alignl}±íʾ×ó¶ÔÆ룬${alignc}±íʾ¾ÓÖжÔÆë¡£
ÐèҪעÒâµÄÊÇ£¬${}Öж¨ÒåµÄÑÕÉ«ºÍ×ÖÌåÊôÐÔ½«Ò»Ö±Ó°Ïìµ½ConkyÅäÖÃÎļþµÄ×îºó£¬¼´Èç¹ûÄãÔÚÇ°Ã涨ÒåÁ˵ÚÒ»ÐеÄÑÕɫΪ¡°white¡±£¬ÄÇôÒÔºó¸÷ÐеÄÑÕÉ«¶¼ÊÇ°×É«¡£ËùÒÔÔ­ÔòÉÏÄãÐèҪΪÿһÐÐÉõÖÁÿһÐеĸ÷¸öÔªËØÉ趨ÑÕÉ«»òÕß×ÖÌåÊôÐÔ¡£
ÎÄ×Ö¼´ConkyÏÔʾÔÚÆÁÄ»ÉϵÄÎÄ×Ö£¬Ëü²»ÐèÒªÌرðµÄ¶¨Ò壬ÄãÏ£ÍûConkyÏÔʾʲôÎÄ×Ö¾ÍÌí¼ÓʲôÎÄ×Ö¼´¿É¡£
ÔªËؼ´³ÊÏÖÔÚÆÁÄ»ÉϵÄÄÇЩ½ø¶ÈÌõ¡¢ÄãÒª¼àÊÓµÄϵͳ״̬µÈµÈ£¬¸ñʽΪ£º${¼àÊÓÄ¿±ê ²ÎÊý}
Èç¹ûûÓвÎÊý£¬Ò²¿ÉÒÔÖ±½ÓʹÓà $¼àÊÓÄ¿±ê µÄ¸ñʽ¡£

###############################TEXT ##################################################
ÏÂÃæ½éÉÜһЩ³£ÓõÄÔªËغÍÆä²ÎÊýµÄ¸ñʽ£º
1¡¢time£º²ÉÓÃstrftimeµÄ²ÎÊý¸ñʽ£¬Æä²ÎÊýÓкü¸¸ö£¬ÑùÀý£º${color white}${font ÎÄȪæä΢Ã׺Ú:style=Bold:size=12}${time %b%dÈÕ ÐÇÆÚ%a}${alignr}${time %p%l:%M:%S}
¼´Êä³ö×ÖÌåΪÎÄȪæä΢Ã׺ڡ¢×ÖÌå´óСΪ12ÏñËØ¡¢´ÖÌå¡¢ÑÕɫΪ°×É«£¬ÒÀ´ÎÊä³öÔ¡¢ÈÕ¡¢ÐÇÆÚ¼¸£¬ºóÃæÒÔ12Сʱ¸ñʽÊä³öʱ¼ä²¢ÏòÓÒ¶ÔÆë¡£
2¡¢nodename£º±¾»úÔÚÍøÂçÉϵÄÃû³Æ¡£
sysname£ºÈçLinux¡£
kernel£ºÄں˰汾¡£
machine£ºÓ²¼þϵͳÀàÐÍ£¬Èçi686¡£
3¡¢stippled_hr£ºÔÚ±¾ÐÐÓàϵĿռäÊä³öÐéÏߣ¬¶àÓÃÓÚ·Ö¸ôÇø¿é¡£
4¡¢uptime£ºÏµÍ³³ÖÐøÔËÐÐʱ¼ä¡£
5¡¢cpu£ºCPUʵʱռÓðٷֱȡ£
cpubar£ºCPUÕ¼ÓõĽø¶ÈÌõÑùʽ¡£
cpugraph£ºCPUÕ¼ÓõÄƵÆ×ͼÑùʽ¡£¸ÃÔªËØ¿ÉÒÔ¼ÓÁ½¸öÑÕÉ«Öµ×÷²ÎÊý£¬ÊµÏÖÑÕÉ«½¥±ä£º${cpugraph 000000 5000a0}
6¡¢mem£ºÄÚ´æʵʱռÓôóС¡£
memmax£ºÄÚ´æ×ÜÁ¿¡£
memperc£ºÄÚ´æʵʱռÓðٷֱȡ£
swap¡¢swapmax¡¢swappercÊÇÐéÄâÄÚ´æµÄÏàÓ¦²ÎÊý¡£
7¡¢processes£ºÕýÔÚÔËÐеĽø³ÌÊý¡£
running_processes£º»îÔ¾µÄ½ø³ÌÊý¡£
8¡¢addr ppp0£ºÏÔʾADSL²¦ºÅ½¨Á¢µÄÁ¬½ÓµÄIPµØÖ·£¬¡°addr eth0¡±±íʾÏÔʾµÚÒ»¿éÍø¿¨µÄIPµØÖ·¡£
9¡¢offset 70£º±íʾÏà¶ÔÓÚµ±Ç°Î»ÖÃÏòÓÒÆ«ÒÆ70ÏñËØ¡£
10¡¢downspeed eth0£ºµÚÒ»¿éÍø¿¨ÏÂÔØÊý¾ÝµÄʵʱËٶȡ£
upspeed eth0£ºµÚÒ»¿éÍø¿¨ÉÏ´«Êý¾ÝµÄʵʱËٶȡ£
downspeedgraph eth0 32,150 ff0000 0000ff£ºÒÔƵÆ×ͼµÄÑùʽÏÔʾµÚÒ»¿éÍø¿¨ÏÂÔØËٶȣ¬¸ß¶ÈΪ32ÏñËØ£¬¿í¶ÈΪ150ÏñËØ£¬ºóÃæÊÇÁ½ÖÖÑÕÉ«£¬ÓÃÓÚ½¥±äÉ«¡£
upspeedgraph eth0 ¡­£ºÓ÷¨Í¬ÉÏ¡£
11¡¢fs_used /home£ºÏÔʾ¹ÒÔص½/homeÎļþ¼ÐϵÄÓ²ÅÌ·ÖÇøµÄʹÓÃÁ¿¡£
fs_size /home£ºÏÔʾ¹ÒÔص½/homeÎļþ¼ÐϵÄÓ²ÅÌ·ÖÇøµÄ×ÜÁ¿¡£
fs_bar /home£ºÒÔ½ø¶ÈÌõÑùʽÏÔʾ¹ÒÔص½/homeÎļþ¼ÐϵÄÓ²ÅÌ·ÖÇøµÄÕ¼ÓÃÁ¿¡£
12¡¢top name 1£º°´CPUÕ¼ÓôӴóµ½Ð¡ÅÅÐòµ±Ç°½ø³Ì²¢ÏÔʾµÚÒ»¸öµÄÃû×Ö¡£
top mem 2£º°´CPUÕ¼ÓôӴóµ½Ð¡ÅÅÐòµ±Ç°½ø³Ì²¢ÏÔʾµÚ¶þ¸öµÄÄÚ´æÕ¼ÓÃÁ¿¡£
top pid 3£º°´CPUÕ¼ÓôӴóµ½Ð¡ÅÅÐòµ±Ç°½ø³Ì²¢ÏÔʾµÚÈý¸öµÄpidºÅ¡£
top cpu 4£º°´CPUÕ¼ÓôӴóµ½Ð¡ÅÅÐòµ±Ç°½ø³Ì²¢ÏÔʾµÚËĸöµÄCPUÕ¼ÓÃÁ¿¡£
top_mem°´ÄÚ´æÕ¼ÓôӴóµ½Ð¡ÅÅÐòµ±Ç°½ø³Ì¡£
13¡¢mpd_status£º¼àÊÓmpdµÄ״̬¡£
mpd_elapsed£º¸èÇúµÄÒѲ¥·Åʱ¼ä¡£
mpd_length£ºµ±Ç°²¥·Å¸èÇúµÄ³¤¶È¡£
mpd_bar£ºµ±Ç°²¥·Å¸èÇúµÄ½ø¶ÈÌõ¡£
mpd_smart£ºÖÇÄÜÅжϵ±Ç°¸èÇúµÄÊä³öÐÅÏ¢£¬Èç¹ûid3¿ÉÓã¬ÔòÊä³ö¡±¸èÊÖ-¸èÃû¡°µÄ¸ñʽ£¬Èç¹ûid3²»¿ÉÓã¬ÔòÊä³öµ±Ç°¸èÇúµÄÎļþÃû¡£
³ýmpdÍ⣬ConkyÖ§³Ö¶Ôaudacious¡¢bmp¡¢xmmsµÄ¼àÊÓ¡£
14¡¢rss£º¶©ÔÄÒ»¸öfeed²¢ÏÔʾÆä×îеļ¸¸öÌõÄ¿µÄ±êÌâµÈÐÅÏ¢£¬Èç
${rss http://feed.feedsky.com/my_cnbeta 5 item_titles 10}
¼´Ã¿¸ôÎå·ÖÖÓ»ñÈ¡¸ÃÔ´µÄ×îÐÂÌõÄ¿£¬²¢Êä³ö×îеÄÊ®¸öÌõÄ¿µÄ±êÌâ¡£
15¡¢tcp_portmon£º¼àÊÓµ±Ç°Ê¹ÓõĶ˿ڣ¬Ä¿Ç°Ö»Ö§³ÖIPv4¡£Ê¹ÓøñʽΪ£º
tcp_portmon port_begin port_end item (index)
16¡¢exec£ºÖ´ÐÐÒ»¸öshellÃüÁî²¢°Ñ½á¹ûÊä³öµ½ÆÁÄ»ÉÏ¡£ºóÃæÌìÆø»ñÈ¡µÄÈýÖÖ·½·¨ÖÐÓÐÁ½¸öÓõ½Õâ¸öº¯Êý¡£
17¡¢acpitemp£º¼àÊÓ²¢Êä³öCPUζȣ¬ÉãÊÏαꡣConkyÖ§³ÖºÜ¶àÖÖCPUζȼàÊÓ·½°¸¡£²»¹ýacpitemp²»Ö§³Ö¶àºË£¬ÒªÏÔʾÁíÒ»¸öºËÐĵÄζȵÃÓà hwmon temp 2
18¡¢diskio£º¼àÊÓµ±Ç°Ó²Å̶ÁдËٶȡ£
19¡¢diskiograph£ºÒÔƵÆ×ÐÎʽÊä³öÓ²Å̶ÁдƵ¶È£¬Ó÷¨Èçcpugraph¡£

#######################################################################################

ÎÒËù×öµÄ¾ÍÊÇÊÕ¼¯conky¸÷ÖÖÖ÷Ì⣬ѡÔñ×ÔÈÏΪʵÓúÿ´µÄpart£¬½ØÑ¡¡¢×éºÏ¡¢¸ü¸ÄºÍµ÷Å䣬´ïµ½×Ô¼ºÂúÒâµÄЧ¹û¡£

ÕâÀïÖ÷Òª½éÉÜÌìÆø»ñÈ¡ºÍʱÖÓÂÖ£¨ÍøËÙ¼à²â£©ÊµÏֵķ½·¨Óë¹ý³Ì¡£
##################################mark#########################################
×îÏÈÕÒµ½µÄÊÇÒ»¶Î¼à²âÓÐÏßÍø¿¨µÄÖ÷Ìâ³ÌÐò£¨Í¼3£©£¬Èç¹ûÊÇ̨ʽ»ú£¬Ö»ÓÐÓÐÏßÍø¿¨£¬ÓÃÕâ¶Î³ÌÐò×ãÒÔ±£Ö¤ÍøËÙµÄÕýÈ·¼ì²â£¬

[mw_shl_code=powershell,true]${font ÎÄȪæä΢Ã׺Ú:style=Bold:size=11}ÏÂÔØËÙ¶È: ${font Impact:size=9}${downspeed eth0} k/s ${font ÎÄȪæä΢Ã׺Ú:style=Bold:size=11}ÉÏ´«ËÙ¶È:${alignr}${font Impact:size=9}${upspeed eth0} k/s
${color #88aadd}${downspeedgraph eth0 15,105 ff0000 0000ff} $alignr${color #88aadd}${upspeedgraph eth0 15,105 0000ff ff0000}

${color white}${font ÎÄȪæä΢Ã׺Ú:style=Bold:size=11}ÏÂÔØ×ÜÁ¿ ${font Impact:size=9}${totaldown eth0} ${font ÎÄȪæä΢Ã׺Ú:style=Bold:size=11}${alignr}ÉÏ´«×ÜÁ¿ ${font Impact:size=9}${totalup eth0}[/mw_shl_code]
# eth0ÊÇÓÐÏßÍø¿¨µÄ½Ó¿Ú
µ«±¾ÈËϲ»¶¾­³£ÓÃÎÞÏß°¡£¬ÍøËÙÄÇ×ÜÊÇ0£¬ÄDz»ÊǷϲÄô£¬Ö×ô°ì£¬ÔõÑù²ÅÄÜÈÃÆä×ÔÊÊÓ¦µÄÅжϹ¤×÷Íø¿¨²¢Õý³£ÏÔʾÍøËÙßÖ£¿
Õâ¾ÍµÃʹÓÃifÓï¾äÀ´×÷³öÑ¡ÔñÁË£¬

[mw_shl_code=powershell,true]# |--WLAN0
${if_up wlan0}
${voffset 5}${color FFFFFF}${goto 125}¡ý${downspeed wlan0}${color FF6600}/${totaldown wlan0}
${color FFFFFF}${goto 125}¡ü${upspeed wlan0}${color FF6600}${color FF6600}/${totalup wlan0}
${color FF6600}${goto 125}Net
${voffset -2}${goto 55} Signal: ${color1}${wireless_link_qual wlan0}% ${font Liberation Sans:style=Bold:size=8}${color #dcff82}${wireless_essid wlan0}
#${color}${font} ${alignr}${color2}${wireless_link_bar 8,60 wlan0}${color}
${voffset 2}${goto 55} ${color FF6600} LocalIP: ${color #FFDC35}${addr wlan0}
# |--ETH0
${else}${if_up eth0}
${voffset 15}${color FFFFFF}${goto 125}¡ý${downspeed eth0}${color FF6600}/${totaldown eth0}
${color FFFFFF}${goto 125}¡ü${upspeed eth0}${color FF6600}${color FF6600}/${totalup eth0}
${color FF6600}${goto 125}Net
${voffset 4}${font}${color FF6600}${goto 105}${voffset -4}LocalIP: ${color #FFDC35}${addr eth0}${color}
# |--PPP0
${endif}${else}${if_up ppp0}
${voffset 15}${color FFFFFF}${goto 125}¡ý${downspeed ppp0}${color FF6600}/${totaldown ppp0}
${color FFFFFF}${goto 125}¡ü${upspeed ppp0}${color FF6600}${color FF6600}/${totalup ppp0}
${color FF6600}${goto 125}Net
${font}${color FF6600}${goto 32}${voffset -4}LocalIP: ${alignr}${color2}${addr ppp0}${color}
${endif}${else}${voffset 4}${color0}${font PizzaDude Bullets:size=12}4${font}${color}${goto 32}Network Unavailable${endif}${endif}[/mw_shl_code]
ÎÞÏßÍø¿¨½Ó¿Ú£ºwlan0

Èç¹ûÖ»ÊÇÏÔʾËٶȣ¬ÄÇôOK£¬ÎÊÌâ½â¾öÁË¡£¿ÉÔÛÊǸö×·ÇóÍêÃÀµÄÈË£¬ÔÙ¸øËü¼ÓÒ»¸öͼÐδ°¿Ú°É£¬ÆÕͨµÄÌõ×´bar²»ºÃ¿´£¬ÄÇ»¹µÃ¼ÌÐøŬÁ¦²ÅÐв»ÊÇ{:11_1402:}
¾­¹ý²»Ð¸²éÕÒ£¬ÖÕÓÚÈÃÎÒ·¢ÏÖÒ»ÖÖʱÖÓÐ͵ÄʵÏÖ·½Ê½¡£ÍâºÅ£ºµ°µ°conky¡£{:11_1365:}
Õâ¸öÅäÖÃÐèÒªÁíÍâ¼ÓÔؽű¾£ºclock_rings.lua¡£¸´ÖÆÒÔÏ´úÂë±£´æΪclock_rings.lua
×¢½â£ºÔÚÍøÂçÒ»¶Î Èç
name='downspeedf',
arg='wlan0',
max=1000,
ÖÐ1000µÄµ¥Î»ÎªKB£¬Çë¸ù¾Ý×Ô¼ºËùÔÚÍøÂçµÄʵ¼Ê´ø¿íÐ޸ģ¬·ñÔò»á³öÏֱ仯²»Ã÷ÏÔ£¨´ø¿íСÉèÖùý´ó£©»ò¶¯ÔòÂúËÙ£¨ÉèÖÃ̫С£©

[mw_shl_code=bash,true]--[[
Clock Rings by Linux Mint (2011) reEdited by despot77

This script draws percentage meters as rings, and also draws clock hands if you want! It is fully customisable; all options are described in the script. This script is based off a combination of my clock.lua script and my rings.lua script.

IMPORTANT: if you are using the 'cpu' function, it will cause a segmentation fault if it tries to draw a ring straight away. The if statement on line 145 uses a delay to make sure that this doesn't happen. It calculates the length of the delay by the number of updates since Conky started. Generally, a value of 5s is long enough, so if you update Conky every 1s, use update_num>5 in that if statement (the default). If you only update Conky every 2s, you should change it to update_num>3; conversely if you update Conky every 0.5s, you should use update_num>10. ALSO, if you change your Conky, is it best to use "killall conky; conky" to update it, otherwise the update_num will not be reset and you will get an error.

To call this script in Conky, use the following (assuming that you save this script to ~/scripts/rings.lua):
lua_load ~/scripts/clock_rings.lua
lua_draw_hook_pre clock_rings

Changelog:
+ v1.0 -- Original release (30.09.2009)
v1.1p -- Jpope edit londonali1010 (05.10.2009)
*v 2011mint -- reEdit despot77 (18.02.2011)
]]

settings_table = {
{
-- Edit this table to customise your rings.
-- You can create more rings simply by adding more elements to settings_table.
-- "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
name='time',
-- "arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''.
arg='%I.%M',
-- "max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
max=12,
-- "bg_colour" is the colour of the base ring.
bg_colour=0xffffff,
-- "bg_alpha" is the alpha value of the base ring.
bg_alpha=0.1,
-- "fg_colour" is the colour of the indicator part of the ring.
fg_colour=0xFF6600,
-- "fg_alpha" is the alpha value of the indicator part of the ring.
fg_alpha=0.2,
-- "x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
x=100, y=150,
-- "radius" is the radius of the ring.
radius=50,
-- "thickness" is the thickness of the ring, centred around the radius.
thickness=5,
-- "start_angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative.
start_angle=0,
-- "end_angle" is the ending angle of the ring, in degrees, clockwise from top. Value can be either positive or negative, but must be larger than start_angle.
end_angle=360
},
{
name='time',
arg='%M.%S',
max=60,
bg_colour=0xffffff,
bg_alpha=0.1,
fg_colour=0xFF6600,
fg_alpha=0.4,
x=100, y=150,
radius=56,
thickness=5,
start_angle=0,
end_angle=360
},
{
name='time',
arg='%S',
max=60,
bg_colour=0xffffff,
bg_alpha=0.1,
fg_colour=0xFF6600,
fg_alpha=0.6,
x=100, y=150,
radius=62,
thickness=5,
start_angle=0,
end_angle=360
},
{
name='time',
arg='%d',
max=31,
bg_colour=0xffffff,
bg_alpha=0.1,
fg_colour=0xFF6600,
fg_alpha=0.8,
x=100, y=150,
radius=70,
thickness=5,
start_angle=-90,
end_angle=90
},
{
name='time',
arg='%m',
max=12,
bg_colour=0xffffff,
bg_alpha=0.1,
fg_colour=0xFF6600,
fg_alpha=1,
x=100, y=150,
radius=76,
thickness=5,
start_angle=-90,
end_angle=90
},
{
name='cpu',
arg='cpu0',
max=100,
bg_colour=0xffffff,
bg_alpha=0.2,
fg_colour=0xFF6600,
fg_alpha=0.8,
x=50, y=300,
radius=25,
thickness=5,
start_angle=-90,
end_angle=180
},
{
name='cpu',
arg='cpu1',
max=100,
bg_colour=0xFFFFFF,
bg_alpha=0.2,
fg_colour=0xffff00,
fg_alpha=0.8,
x=110, y=300,
radius=25,
thickness=5,
start_angle=-90,
end_angle=180
},
{
name='memperc',
arg='',
max=100,
bg_colour=0xffffff,
bg_alpha=0.2,
fg_colour=0x33ccff,
fg_alpha=0.8,
x=75, y=350,
radius=25,
thickness=5,
start_angle=-90,
end_angle=180
},
{
name='swapperc',
arg='',
max=100,
bg_colour=0xffffff,
bg_alpha=0.2,
fg_colour=0xFF6600,
fg_alpha=0.8,
x=100, y=400,
radius=25,
thickness=5,
start_angle=-90,
end_angle=180
},
{
name='fs_used_perc',
arg='/',
max=100,
bg_colour=0xffffff,
bg_alpha=0.2,
fg_colour=0x306ACD,
fg_alpha=0.8,
x=125, y=450,
radius=25,
thickness=5,
start_angle=-90,
end_angle=180
},
{
name='downspeedf',
arg='wlan0',
max=1000,
bg_colour=0xffffff,
bg_alpha=0.2,
fg_colour=0x339900,
fg_alpha=0.8,
x=145, y=500,
radius=25,
thickness=4,
start_angle=-90,
end_angle=180
},
--ºÜÒź¶ÕâÀïµÄ×ÔÊÊÓ¦ÎÒ»¹Ã»ÕÒµ½°ì·¨ÊµÏÖ£¬Ö»ÄÜʹÓÃÊÖ¶¯Ð޸ĵİ취¡£ÎÒÓõÄÎÞÏߣ¬Èç¹ûÄãÓÃÓÐÏßÇ뽫½Ó¿Úwlan0¸ÄΪeth0»òÆäËû£¨ÐèÒª²é¿´Íø¿¨½Ó¿Ú£©£¬ÏÂͬ¡£
{
name='upspeedf',
arg='wlan0',
max=100,
bg_colour=0xffffff,
bg_alpha=0.2,
fg_colour=0xff6600,
fg_alpha=0.8,
x=145, y=500,
radius=20,
thickness=4,
start_angle=-90,
end_angle=180
},
}

-- Use these settings to define the origin and extent of your clock.

clock_r=65

-- "clock_x" and "clock_y" are the coordinates of the centre of the clock, in pixels, from the top left of the Conky window.

clock_x=100
clock_y=150

show_seconds=true

require 'cairo'

function rgb_to_r_g_b(colour,alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

function draw_ring(cr,t,pt)
local w,h=conky_window.width,conky_window.height

local xc,yc,ring_r,ring_w,sa,ea=pt['x'],pt['y'],pt['radius'],pt['thickness'],pt['start_angle'],pt['end_angle']
local bgc, bga, fgc, fga=pt['bg_colour'], pt['bg_alpha'], pt['fg_colour'], pt['fg_alpha']

local angle_0=sa*(2*math.pi/360)-math.pi/2
local angle_f=ea*(2*math.pi/360)-math.pi/2
local t_arc=t*(angle_f-angle_0)

-- Draw background ring

cairo_arc(cr,xc,yc,ring_r,angle_0,angle_f)
cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
cairo_set_line_width(cr,ring_w)
cairo_stroke(cr)

-- Draw indicator ring

cairo_arc(cr,xc,yc,ring_r,angle_0,angle_0+t_arc)
cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
cairo_stroke(cr)
end

function draw_clock_hands(cr,xc,yc)
local secs,mins,hours,secs_arc,mins_arc,hours_arc
local xh,yh,xm,ym,xs,ys

secs=os.date("%S")
mins=os.date("%M")
hours=os.date("%I")

secs_arc=(2*math.pi/60)*secs
mins_arc=(2*math.pi/60)*mins+secs_arc/60
hours_arc=(2*math.pi/12)*hours+mins_arc/12
-- 12 short lines to indicate 0-11
-- change the step(the last number) to control the num of short lines,
-- say, change to 3
for i=0,11,3 do
xh=xc+0.74*clock_r*math.sin(2*math.pi/360*i*30)
yh=yc-0.74*clock_r*math.cos(2*math.pi/360*i*30)
cairo_move_to(cr,xh,yh)

--emphasize 0,3,6,9
local scale = 0.73
if (i % 3) == 0 then
scale = 0.70
end
xh=xc+scale*clock_r*math.sin(2*math.pi/360*i*30)
yh=yc-scale*clock_r*math.cos(2*math.pi/360*i*30)

cairo_line_to(cr,xh,yh)

cairo_set_line_width(cr,2)
cairo_set_source_rgba(cr,0.2,0.6,1,1.0)
cairo_stroke(cr)
end

-- Draw hour hand

xh=xc+0.7*clock_r*math.sin(hours_arc)
yh=yc-0.7*clock_r*math.cos(hours_arc)
cairo_move_to(cr,xc,yc)
cairo_line_to(cr,xh,yh)

cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_set_line_width(cr,5)
cairo_set_source_rgba(cr,1.0,1.0,1.0,1.0)
cairo_stroke(cr)

-- Draw minute hand

xm=xc+clock_r*math.sin(mins_arc)
ym=yc-clock_r*math.cos(mins_arc)
cairo_move_to(cr,xc,yc)
cairo_line_to(cr,xm,ym)

cairo_set_line_width(cr,3)
cairo_stroke(cr)

-- Draw seconds hand

if show_seconds then
xs=xc+clock_r*math.sin(secs_arc)
ys=yc-clock_r*math.cos(secs_arc)
cairo_move_to(cr,xc,yc)
cairo_line_to(cr,xs,ys)

cairo_set_line_width(cr,1)
cairo_stroke(cr)
end
end

function conky_clock_rings()
local function setup_rings(cr,pt)
local str=''
local value=0

str=string.format('${%s %s}',pt['name'],pt['arg'])
str=conky_parse(str)

value=tonumber(str)
pct=value/pt['max']

draw_ring(cr,pct,pt)
end

-- Check that Conky has been running for at least 5s

if conky_window==nil then return end
local cs=cairo_xlib_surface_create(conky_window.display,conky_window.drawable,conky_window.visual, conky_window.width,conky_window.height)

local cr=cairo_create(cs)

local updates=conky_parse('${updates}')
update_num=tonumber(updates)

if update_num>5 then
for i in pairs(settings_table) do
setup_rings(cr,settings_table)
end
end

draw_clock_hands(cr,clock_x,clock_y)
end[/mw_shl_code]

ÍøËÙ¼à²âµÄÎÊÌâ½â¾öÁË»¹ÓÐÒ»¸öÁîÈËÍ·ÌÛµÄÌìÆøûÓнâ¾öÄØ£¬¿É²»ÄܸßÐ˵ÄÌ«Ôç¡£
¶¼ÕâÑùÁË»¹²»Âú×㻹ҪҪÕÛÌÚ£¬Õâ²»ÊÇÒªÈËÀÏÃüô{:11_1404:}
Óо仰˵µÄºÃ£¬ÉúÃü×Ó°¡ÓëÔ˶¯£¬Éú»îÔÚÓÚÕÛÌÚ£¡{:11_1411:}

ÕÛÌڵĽá¹û¾ÍÊÇ´Ó×î³õÎÞ´ÓÏÂÊÖ£¬µ½×îºóÓÐÈýÖÖ·½·¨ÏÔʾÌìÆøÎÊÌ⣬ÕâÒ²ËãÒ»´ó½ø²½ÊDz»ÊÇ{:11_1397:}

#################################Weather Forecast##########################################

ʵÏÖ·½Ê½Ò»
Ò²ÊÇ×îÔçÕÒµ½×î¼òµ¥µ«Ã»ÒýÆð×¢ÒâµÄ·½Ê½£¬Ö±µ½ºóÁ½ÖÖͨ¹ýsh½Å±¾³É¹¦ÊµÏÖºóÎҲŻعúÀ´ÉóÊÓÕâÖÖ¼òµ¥µÄ·½·¨¡£
of course£¬·½·¨¼òµ¥ÊµÏÖ½á¹ûÒ²¾Í±È½Ï´Ö²Ú£¬¹¦Äܼòµ¥¡£
Ö±½ÓÀûÓñ¾Éíº¯ÊýweatherÀ´»ñȡij¸öÆøÏóÍøÕ¾£¨¶àÊǹúÍâµÄ£¬Ã×°ì·¨£¬¹úÄÚÍøÕ¾¹¦ÄÜ¡£¡£¡£Ä㶮µÄ£©
¸´ÖÆ´úÂëÖ±½ÓÌí¼ÓÔÚ .conkyrcÖм´¿É

[mw_shl_code=bash,true]weather http://weather.noaa.gov/pub/data/observations/metar/stations/ ZBTJ weather 30[/mw_shl_code]
ZBTJÊÇÌì½òµÄ´úÂ룬Èç¹ûÊÇÆäËû³ÇÊÐÐèÒªµ½http://weather.noaa.gov°´Ìáʾ²Ù×÷²éÕÒ¡£±ÈÈçÑ¡ÔñÀ¥Ã÷ £¬×îºóµÄÍøÒ³µØÖ·À¸¾ÍÊÇ http://weather.noaa.gov/weather/current/ZPPP.html ÄÇôÀ¥Ã÷µÄ´úÂë¾ÍÊÇZPPP¡£µ±È»ÆøÏó½á¹û»¹ÓÐÆäËû²ÎÊý£¨ÎÂ¶È ·çÁ¦ ʪ¶È¡£¡£¡££©¿ÉÒÔµãÇ°ÃæÕâ¸öÁ¬½Ó²é¿´£¬ÒªÏëÔÚconkyÖÐÏÔʾ Ö»Ð轫²ÎÊýweather¸ÄΪÏàÓ¦µÄÔÚÌí¼Óµ½.conkyrcÖм´¿É¡£


ʵÏÖ·½Ê½¶þ

ÀûÓðٶÈËÑË÷ÌìÆø µÚÒ»ÏîĬÈÏÊÇÄãËùʹÓÃIPËùÔÚ³ÇÊеÄÌìÆø£¨ºÙºÙ£¬²»ÐÅ£¬Äã¿ÉÒÔÊÔÊÔ£©
½«ÍøÒ³ÒÔtxtÎı¾ÐÎʽ±£´æÏÂÀ´£¬ÔÙͨ¹ý¹Ø¼ü´Ê¼ìË÷£¬½ØÈ¡ÌìÆø²¿·Ö¡£Õâ¸ö¹Ø¼ü´ÊÐèÒª¸ù¾Ýʵ¼ÊËÑË÷½á¹û¸ü¸Ä¡£
»ñÈ¡°Ù¶ÈÌìÆøµÄ½Å±¾£º¸´ÖƱ£´æΪ weatherimg.sh

[mw_shl_code=shell,true]#!/bin/bash
URL=http://www.baidu.com/s?wd=%CC%EC%C6%F8
baidutq=/tmp/mypogoda
weather=/tmp/pogoda.txt

w3m -dump $URL > $baidutq
end=`cat -n $baidutq | grep "ÖйúÆøÏó¾Ö201" | cut -f1 | sed 's/ *//'`

head -n $end $baidutq | tail -n 6 > $weather
# iconv -f gbk -t utf-8 $weather > $weather # ת»¯Îªutf-8±àÂë
cnd=`~/.conky/scripts/conkytq.sh 1 | cut -d " " -f1`

if echo "$cnd" | grep -E -i -q 'ת'; then
cnd=$(echo "$cnd" | awk -F "ת" '{print $1}')
fi

case $cnd in
'¶àÔÆ')
cond='CloudyPartly.png' ;;
'Çç')
cond='sunny.png' ;;
'Çç¼ä¶àÔÆ')
cond='CloudyLightPartly.png' ;;
'Òõ')
cond='Cloud.png' ;;
'СÓê')
cond='RainLight.png' ;;
'ÖÐÓê')
cond='Rain.png' ;;
'´óÓê')
cond='RainHeavy.png' ;;
'±©Óê')
cond='TorrentialRain.png' ;;
'ÕóÓê')
cond='Shower.png' ;;
'À×ÕóÓê')
cond='tstorms.png' ;;
'´óÑ©')
cond='SnowHeavy.png' ;;
'Óê¼ÓÑ©')
cond='RainMixedSnow.png' ;;
'ÖÐÑ©')
cond='Snow.png' ;;
'Сѩ')
cond='SnowLight.png' ;;
esac

prefstr='${image ~/QQ Files/weather_images/'
poststr=' -s 40x40 -p 150,600 }'
echo $prefstr$cond$poststr[/mw_shl_code]

¹Ø¼ü´Ê¡°ÖйúÆøÏó¾Ö201¡±ÎªÊµ¼ÊËÑË÷½á¹ûÆøÏ󱨸æ½áÊøºóµÄ¿ªÍ·´Ê¡£¼´½ØÈ¡¡°ÖйúÆøÏó¾Ö201¡±ÒÔÇ°µÄÒ»²¿·ÖÔÙ±£´æµ½/tmp/pogoda.txtÖС£
¶ÁÈ¡ÆøÏó²ÎÊý½Å±¾£º¸´ÖƱ£´æΪconkytq.sh

[mw_shl_code=bash,true]#!/bin/bash
weather=/tmp/pogoda.txt
linenum=$(awk '{print $'$1'}' /tmp/pogoda.txt | sed -n '/¡æ/=')
line1=$[$linenum+1]
line2=$[$linenum+2]
tianqi=$(awk '{print $'$1'}' /tmp/pogoda.txt | sed -n ''$line1'p' )
temper=$(awk '{print $'$1'}' /tmp/pogoda.txt | sed -n ''$linenum'P' )
wind=$(awk '{print $'$1'}' /tmp/pogoda.txt | sed -n ''$line2'p' )
echo $tianqi $temper $wind
[/mw_shl_code]

¡æΪÌØÊâ²Î¿¼×ø±ê£¬ÒÔ´ËΪ±ê×¼ÏòÇ°Ò»¸ñ¶ÁÈ¡ÌìÆø ÏòºóÒ»¸ñ¶ÁÈ¡·çÁ¦¡£

ÕâЩ×öºÃºó£¬ÔÚ.conkyrcÖе÷ÓÃÕâÁ½¸ö½Å±¾¼´¿ÉµÃµ½ÌìÆø¡£
µ÷ÓÃÃüÁîÈçÏ£º
${execpi 10800 ~/.conky/scripts/weatherimg.sh}${font Droid Sans Fallback:size=10}${color green}ÌìÆøÔ¤±¨£º $color
${goto 12}½ñÌ죺${execi 10800 ~/.conky/scripts/conkytq.sh 1}

goto 12ÊÇÐÐÖÁXÖáµÄµÚ12¸öÏñÊýµã¡£ÊÇΪÁ˱£³ÖÕûÆëÒ»ÖÂÃÀ¹Û¡£ececiÊÇÇ°ÃæÌáµ½¹ýµÄµ÷ÓÃÖ´ÐÐÍⲿ½Å±¾³ÌÐò¡£
Èç¹ûÄã²»Âú×ãÖ»ÏÔʾһÌìµÄÌìÆø£¬¿ÉÒÔÔÚºóÃæÌí¼Ó
${goto 12}Ã÷Ì죺${execi 10800 ~/.conky/scripts/conkytq.sh 2}
${goto 12}ºóÌ죺${execi 10800 ~/.conky/scripts/conkytq.sh 3}
¶à´ÎÖ´ÐУ¬ÏÔʾ3ÌìÄÚÌìÆø£¨°Ù¶ÈÌìÆø×î¶àÖ»ÓÐ3Ì죩¡£


ʵÏÖ·½Ê½Èý
¸öÈ˾õµÃ¹¦ÄÜ×îÇ¿´ó£¬ÊµÏÖ½á¹û×îƯÁÁµÄ·½·¨£¡ºÙºÙ£¬µ«ÊÇÔÛ²»¸æËßÄ㣬{:11_1397:}

{:2_114:}¡£
×îºóʵÏÖЧ¹ûÈçͼ£º
[attach]37721[/attach] [attach]37722[/attach] [attach]37723[/attach]


¿ª¸öÍæЦ£¬ºÃ¶«Î÷µ±È»Òª´ó¼ÒÒ»Æð·ÖÏíÀ²¡£


»ñÈ¡ÍøÕ¾µÄÆøÏ󱨸æÎļþ½Å±¾ conky_api.sh Ìì½ò´úÂ룺CHXX0133 Çë¸ù¾ÝËùÔÚ³ÇÊиü¸Äcity_code
»ñÈ¡³ÇÊдúÂëÇëÇ°Íùhttp://www.weather.com/common/welcomepage/world.html>: http://www.weather.com/common/welcomepage/world.html

[mw_shl_code=bash,true]#!/usr/bin/env bash

conky_dir=~/.conky/
icons_dir=${conky_dir}icons/
weather_xslt=${conky_dir}weather.xslt
weather_xml=/tmp/conky_weather.xml
city_code=CHXX0133

function xsltproc_run() {
day_number=$1
field=$2
moment='d'
result=""
if [ $# -eq 3 ]; then
moment=$3
fi
result=$(xsltproc --stringparam day $day_number --stringparam moment $moment $weather_xslt $weather_xml| cut -d "|" -f$field)
echo $result
}


function get_weather_xml() {
c=$city_code
w=$weather_xml
if [ $# -ge 1 ]; then
c=$1
fi
if [ $# -ge 2 ]; then
w=$2
fi
wget "http://xml.weather.com/weather/local/${c}?cc=*&unit=m&dayf=3" -O ${w}
return 0
}

function get_weather_day() {
echo $(xsltproc_run $1 3)
}

function get_weather_icons() {
day=$1
moment='d'
if [ $# -eq 2 ]; then
moment=$2
fi
if [ $moment == 'd' ]; then
cp $icons_dir$(xsltproc_run $day 6 $moment).png /tmp/weather$day.png
elif [ $moment == 'n' ]; then
cp $icons_dir$(xsltproc_run $day 6 $moment).png /tmp/weathern$day.png
else
echo "Usage: get_weather_icons day [moment]"
echo "day is a number beatween 0 and 6"
echo "moment is the letter 'd' or 'n'"
fi
return 0
}

function get_weather_min() {
day=$1
moment='d'
result=""
if [ $# -eq 2 ]; then
moment=$2
fi
if [[ ( $# -ge 1 ) && ( $# -le 2 ) ]]; then
result=$(xsltproc_run $day 4 $moment)
else
echo "Usage: get_weather_icons day [moment]"
echo "day is a number beatween 0 and 6"
echo "moment is the letter 'd' or 'n'"
fi
echo $result
}

function get_weather_max() {
day=$1
moment='d'
result=""
if [ $# -eq 2 ]; then
moment=$2
fi
if [[ ( $# -ge 1 ) && ( $# -le 2 ) ]]; then
result=$(xsltproc_run $day 5 $moment)
else
echo "Usage: get_weather_icons day [moment]"
echo "day is a number beatween 0 and 6"
echo "moment is the letter 'd' or 'n'"
fi
echo $result
}[/mw_shl_code]

wget "http://xml.weather.com/weather/local/${c}?cc=*&unit=m&dayf=n" ²ÎÊýn¿ÉÒÔÔÚ1-7¼ä¸ü¸Ä£¬¼´»ñÈ¡nÌìµÄÆøÏ󱨸档¿ÉÒÔÔÚä¯ÀÀÆ÷ÖÐÖ±½Ó´ò¿ªhttp://xml.weather.com/weather/local/CHXX0133?cc=*&unit=m&dayf=3 ²é¿´3ÌìµÄÆøÏ󱨸ß


»ñÈ¡ÆøÏóͼƬ½Å±¾install.sh£º

[mw_shl_code=bash,true]#!/usr/bin/env bash
conky_dir=`expr ~/.conky/`
icons_dir=$conky_dir"icons/"
files=(clock_rings.lua conkyrc new-ubuntu-logo.png weather.conky weather.xslt conky_api.sh)

function get_icons {
if [ ! -e "${icons_dir}" ]; then
mkdir "${icons_dir}"
fi
for ((i = 1; i <= 47; i += 1 )); do
wget --no-verbose http://bs.imwx.com/v.20100719.135915/img/wxicon/72/$i.png -O "${icons_dir}${i}.png"
done
}

function usage {
echo "$0 "
echo "for know your city code go to: http://www.weather.com/common/welcomepage/world.html"
}

if [ $# -lt 1 ]; then
usage
else
# create conky dir if do not exist
if [ ! -e "${conky_dir}" ]; then
mkdir "${conky_dir}"
fi
# install files into conky dir
for f in ${files}; do
install -m 0644 "${f}" "${conky_dir}${f}"
done
# set city location in conky file
if [ $1 != "SZXX0017" ]; then
sed -i "s/SZXX0017/$1/" "${conky_dir}${files[5]}"
fi
# add line for start conky
echo -e "\n# run conky\npkill conky\nconky -c ~/.conky/weather.conky &\nconky -c ~/.conky/conkyrc &\n" >> ~/.bash_profile
# get icons from web
get_icons
# start conky
source ~/.bash_profile
fi[/mw_shl_code]


.conkyrcÖеĵ÷ÓÃÃüÁ

[mw_shl_code=bash,true]${font wqy-microhei:size=9}${color 3399ff}${goto 32}Weather Forecast${execi 36000 . ~/.conky/scripts/conky_api.sh; get_weather_xml}
${goto 32}day${execi 36000 . ~/.conky/scripts/conky_api.sh; get_weather_icons 0}${goto 120}night${execi 36000 . ~/.conky/scripts/conky_api.sh; get_weather_icons 0 n}
${goto 32}${voffset 35}min: ${execi 36000 . ~/.conky/scripts/conky_api.sh; get_weather_min 0}${goto 125}min: ${execi 36000 . ~/.conky/scripts/conky_api.sh; get_weather_min 0 n}
${goto 32}max: ${execi 36000 . ~/.conky/scripts/conky_api.sh; get_weather_max 0}${goto 125}max: ${execi 36000 . ~/.conky/scripts/conky_api.sh; get_weather_max 0 n}
${image /tmp/weather0.png -p 47,650}${image /tmp/weathern0.png -p 135,650}[/mw_shl_code]

#####################################O V E R########################################
¸½ÉÏ×îºóµÄÅäÖôúÂ룺
ͨÓÃ.conkyrc:
ÐèÒªÏÔʾÌìÆøµÄÔÚ½«ÌìÆø´úÂ븽¼Óµ½×îºó¼´¿É¡£
[mw_shl_code=bash,true]# Conky settings #
background no
update_interval 1

cpu_avg_samples 2
net_avg_samples 2

override_utf8_locale yes

double_buffer yes
no_buffers yes

text_buffer_size 2048
#imlib_cache_size 0

temperature_unit fahrenheit

# Window specifications #

own_window yes
#own_window_type override
own_window_type normal
own_window_transparent yes
#own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
own_window_hints undecorated,below,skip_taskbar,sticky

border_inner_margin 0
border_outer_margin 0

minimum_size 200 250
maximum_width 200

alignment tr
gap_x 35
gap_y

# Graphics settings #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

# Text settings #
use_xft yes
xftfont ÎÄȪæä΢Ã׺Ú:size=8
xftalpha 0.5

uppercase no

temperature_unit celsius


default_color FFFFFF

# Lua Load #
lua_load ~/.conky/clock_rings.lua
lua_draw_hook_pre clock_rings

TEXT
${voffset 8}${color 9D57B6}${font ÎÄȪæä΢Ã׺Ú:size=16}${time %A}${font}${voffset -8}${alignr 50}${color FFFFFF}${font ÎÄȪæä΢Ã׺Ú:size=38}${time %e}${font}
${color FFFFFF}${voffset -30}${color 339933}${font ÎÄȪæä΢Ã׺Ú:size=18}${time %b}${font}${voffset -3} ${color FFFF50}${font ÎÄȪæä΢Ã׺Ú:size=20}${time %Y}Äê${font}${color FF6600}${hr}
${image ~/.conky/Arch_logo.png -p 74,125 -s 50x50}
${voffset 125}${font :style=Bold:size=8}${alignr}WEATHER${font}
${color FF6600}${font Droid Sans:style=Bold:size=8}Processes: ${font Droid Sans:style=Regular:size=8}$processes ( ${color}${running_processes}${color FF6600} running) ${font Droid Sans:style=Regular:size=10}${color FFFFFF}${alignr}${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ ZBTJ weather 30} ${font}
${color FF6600}${voffset 6}${font Droid Sans:style=Regular:size=10}${nodename}'s Uptime:${color2}${uptime_short}${color}${alignr}${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ ZBTJ temperature 70} ¡ãC
${color FFFFFF}${goto 25}${voffset 35}${cpu cpu0}% ${font Droid Sans:style=Bold:size=8}${color1}${acpitemp}¡ãC${color}${font}${color FFFFFF}${goto 85}${cpu cpu1}% ${font Droid Sans:style=Bold:size=8}${color1}${hwmon temp 2}¡ãC${color}${font}
${color FF6600}${goto 25}CPU1${goto 85}CPU2 ƵÂÊ: ${freq} MHz
${color FFFFFF}${goto 50}${voffset 23}${memperc}%
${color FF6600}${goto 50}RAM
${color FFFFFF}${goto 75}${voffset 23}${swapperc}%
${color FF6600}${goto 75}SWAP
${color FFFFFF}${goto 100}${voffset 23}${fs_used_perc /}%
${color FF6600}${goto 100}Disk
# |--WLAN0
${if_up wlan0}
${voffset 5}${color FFFFFF}${goto 125}¡ý${downspeed wlan0}${color FF6600}/${totaldown wlan0}
${color FFFFFF}${goto 125}¡ü${upspeed wlan0}${color FF6600}${color FF6600}/${totalup wlan0}
${color FF6600}${goto 125}Net
${voffset -2}${goto 55} Signal: ${color1}${wireless_link_qual wlan0}% ${font Liberation Sans:style=Bold:size=8}${color #dcff82}${wireless_essid wlan0}
#${color}${font} ${alignr}${color2}${wireless_link_bar 8,60 wlan0}${color}
${voffset 2}${goto 55} ${color FF6600} LocalIP: ${color #FFDC35}${addr wlan0}
# |--ETH0
${else}${if_up eth0}
${voffset 15}${color FFFFFF}${goto 125}¡ý${downspeed eth0}${color FF6600}/${totaldown eth0}
${color FFFFFF}${goto 125}¡ü${upspeed eth0}${color FF6600}${color FF6600}/${totalup eth0}
${color FF6600}${goto 125}Net
${voffset 4}${font}${color FF6600}${goto 105}${voffset -4}LocalIP: ${color #FFDC35}${addr eth0}${color}
# |--PPP0
${endif}${else}${if_up ppp0}
${voffset 15}${color FFFFFF}${goto 125}¡ý${downspeed ppp0}${color FF6600}/${totaldown ppp0}
${color FFFFFF}${goto 125}¡ü${upspeed ppp0}${color FF6600}${color FF6600}/${totalup ppp0}
${color FF6600}${goto 125}Net
${font}${color FF6600}${goto 32}${voffset -4}LocalIP: ${alignr}${color2}${addr ppp0}${color}
${endif}${else}${voffset 4}${color0}${font PizzaDude Bullets:size=12}4${font}${color}${goto 32}Network Unavailable${endif}${endif}
${voffset -10}${goto 32}${color #61265F}${font Narkisim:style=Bold:size=8}Processes ${font Impact:size=8}$alignr CPU ${font Narkisim:size=8} RAM PID
${goto 32}${font Narkisim:size=8:style=Regular}${top name 1}$alignr${top cpu 1}${top mem 1}${top pid 1}
${goto 32}${font Narkisim:size=8:style=Regular}${top name 2}$alignr${top cpu 2}${top mem 2}${top pid 2}
${goto 32}${font Narkisim:size=8:style=Regular}${top name 3}$alignr${top cpu 3}${top mem 3}${top pid 3}
${goto 32}${font Narkisim:size=8:style=Regular}${top_mem name 1}$alignr${top_mem cpu 1}${top_mem mem 1}${top_mem pid 1}
${goto 32}${font Narkisim:size=8:style=Regular}${top_mem name 2}$alignr${top_mem cpu 2}${top_mem mem 2}${top_mem pid 2}
${goto 32}${color #cacaca} Battery:${battery BAT0} ${battery_time BAT0}
[/mw_shl_code]
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 2 ÌõÆÀÂÛ

  1. ly1b1b1bb ÓÚ 2012-12-18 20:45:31·¢±í:

    [i=s] ±¾Ìû×îºóÓÉ ly1b1b1bb ÓÚ 2012-12-18 20:50 ±à¼­ [/i]

    ÀÏ´ó£¬ÄãÄܲ»ÄÜ°ÑÄãµÄÎļþ½á¹¹ËµÒ»Ï£¬ÎÒ°´ÕÕÄã˵µÄ×ö£¬½á¹ûÖ»ÄÜÊÇÕâÑùµÄ£º

  2. Fzzd ÓÚ 2012-04-24 08:51:14·¢±í:

    ¶¥Äã