对 拆分版 的天气预报部分做了改动,换用百度搜索上国家气象局发布的信息。
.conkyrc :
background no
override_utf8_locale yes
font DejaVu Sans:size=9
xftfont DejaVu Sans:size=9
use_xft yes
xftalpha 0.1
update_interval 1.5
total_run_times 0
own_window yes
#own_window_class Conky
own_window_type desktop
own_window_transparent no
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
minimum_size 165 5
maximum_width 230
alignment middle_right
gap_x 5
gap_y 0
#no_buffers yes
cpu_avg_samples 2
uppercase no
use_spacer none
out_to_console no
default_color moccasin
default_shade_color black
default_outline_color grey90
TEXT
${exec whoami} @ $nodename $machine ${color 22ccff} ${font OpenLogos:size=28}B $color
${voffset -36}${font}Pacman: ${font 文泉驿正黑:size=10}${color green}${exec ~/scripts/conky-updates.pl} $color
${font StyleBats:size=10}M${voffset -2}${font 文泉驿正黑:size=10} 进程:$alignr$processes个 ($running_processes 个活跃进程)
${font Martin Vogel's Symbols:size=10}h${font}${color slate grey} Highest CPU:$alignr -PID- CPU% $color
${color #ddaa00}${top name 1}$alignr${top pid 1} ${top cpu 1}
${color lightgrey}${top name 2}$alignr${top pid 2} ${top cpu 2}
${color lightgrey}${top name 3}$alignr${top pid 3} ${top cpu 3}
${color lightgrey}${top name 4}$alignr${top pid 4} ${top cpu 4} ${color}
${voffset -3}${stippled_hr}
${font Martin Vogel's Symbols:size=10}j${font}${color slate grey} Highest MEM:$alignr -PID- MEM% $color
${color #ddaa00}${top_mem name 1}$alignr${top_mem pid 1} ${top_mem mem 1}
${color lightgrey}${top_mem name 2}$alignr${top_mem pid 2} ${top_mem mem 2}
${color lightgrey}${top_mem name 3}$alignr${top_mem pid 3} ${top_mem mem 3}
${color lightgrey}${top_mem name 4}$alignr${top_mem pid 4} ${top_mem mem 4}
${color slate grey}RAM:$color $alignr $memperc% used
${color 8844ee}${membar 4,105} $alignr$color$mem/$memmax
${color slate grey}/: $color ${alignc}/dev/sda7 $alignr ${fs_free_perc /}% free
${color 8844ee}${fs_bar 4,105 /} $alignr${color}${fs_free /}/${fs_size /}
${color slate grey}/var: $color ${alignc}/dev/sda8 $alignr ${fs_free_perc /var}% free
${color 8844ee}${fs_bar 4,105 /var} $alignr${color}${fs_free /var}/${fs_size /var}
${color slate grey}windows: $color ${alignc}/dev/sda1 $alignr${fs_free_perc /media/windows}% free
${color 8844ee}${fs_bar 4,105 /media/windows} $alignr$color${fs_free /media/windows}/${fs_size /media/windows}
${color slate grey}DATA: $color ${alignc}/dev/sda6 $alignr${fs_free_perc /media/DATA}% free
${color 8844ee}${fs_bar 4,105 /media/DATA} $alignr$color${fs_free /media/DATA}/${fs_size /media/DATA}
${color}${font PizzaDude Bullets:size=12}?${font} IP Address: $alignr${addr eth0} ${color}
${font 文泉驿正黑:size=10}总计: ${color #8844ee}${font PizzaDude Bullets:size=10}M${font} ${totalup eth0} ${alignr}${color #22ccff}${font PizzaDude Bullets:size=10}S${font} ${totaldown eth0}
${color slate grey}${font} Up: ${color #8844ee}${upspeed eth0}/s ${alignr}${color slate grey}Down: ${color #22ccff}${downspeed eth0}/s
${voffset -4}$color${upspeedgraph eth0 30,100 8844ee 22ccff}$alignr${downspeedgraph eth0 30,100 8844ee 22ccff}
${voffset -12}$color${font Martin Vogel's Symbols:size=20}k${font}${color slate grey} ${voffset -8}E-Mail: OMG@gmail.com $color
${font 文泉驿正黑:size=10}$alignr 有 ${color green}${texeci 7200 ~/scripts/check_gmail.sh}$color 封新邮件,来自:
${voffset -4}${font DejaVu Sans:size=8}${execi 7200 ~/scripts/gmail.pl `~/scripts/check_gmail.sh`}
override_utf8_locale yes
font DejaVu Sans:size=9
xftfont DejaVu Sans:size=9
use_xft yes
xftalpha 0.1
update_interval 1.5
total_run_times 0
own_window yes
#own_window_class Conky
own_window_type desktop
own_window_transparent no
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
minimum_size 165 5
maximum_width 230
alignment middle_right
gap_x 5
gap_y 0
#no_buffers yes
cpu_avg_samples 2
uppercase no
use_spacer none
out_to_console no
default_color moccasin
default_shade_color black
default_outline_color grey90
TEXT
${exec whoami} @ $nodename $machine ${color 22ccff} ${font OpenLogos:size=28}B $color
${voffset -36}${font}Pacman: ${font 文泉驿正黑:size=10}${color green}${exec ~/scripts/conky-updates.pl} $color
${font StyleBats:size=10}M${voffset -2}${font 文泉驿正黑:size=10} 进程:$alignr$processes个 ($running_processes 个活跃进程)
${font Martin Vogel's Symbols:size=10}h${font}${color slate grey} Highest CPU:$alignr -PID- CPU% $color
${color #ddaa00}${top name 1}$alignr${top pid 1} ${top cpu 1}
${color lightgrey}${top name 2}$alignr${top pid 2} ${top cpu 2}
${color lightgrey}${top name 3}$alignr${top pid 3} ${top cpu 3}
${color lightgrey}${top name 4}$alignr${top pid 4} ${top cpu 4} ${color}
${voffset -3}${stippled_hr}
${font Martin Vogel's Symbols:size=10}j${font}${color slate grey} Highest MEM:$alignr -PID- MEM% $color
${color #ddaa00}${top_mem name 1}$alignr${top_mem pid 1} ${top_mem mem 1}
${color lightgrey}${top_mem name 2}$alignr${top_mem pid 2} ${top_mem mem 2}
${color lightgrey}${top_mem name 3}$alignr${top_mem pid 3} ${top_mem mem 3}
${color lightgrey}${top_mem name 4}$alignr${top_mem pid 4} ${top_mem mem 4}
${color slate grey}RAM:$color $alignr $memperc% used
${color 8844ee}${membar 4,105} $alignr$color$mem/$memmax
${color slate grey}/: $color ${alignc}/dev/sda7 $alignr ${fs_free_perc /}% free
${color 8844ee}${fs_bar 4,105 /} $alignr${color}${fs_free /}/${fs_size /}
${color slate grey}/var: $color ${alignc}/dev/sda8 $alignr ${fs_free_perc /var}% free
${color 8844ee}${fs_bar 4,105 /var} $alignr${color}${fs_free /var}/${fs_size /var}
${color slate grey}windows: $color ${alignc}/dev/sda1 $alignr${fs_free_perc /media/windows}% free
${color 8844ee}${fs_bar 4,105 /media/windows} $alignr$color${fs_free /media/windows}/${fs_size /media/windows}
${color slate grey}DATA: $color ${alignc}/dev/sda6 $alignr${fs_free_perc /media/DATA}% free
${color 8844ee}${fs_bar 4,105 /media/DATA} $alignr$color${fs_free /media/DATA}/${fs_size /media/DATA}
${color}${font PizzaDude Bullets:size=12}?${font} IP Address: $alignr${addr eth0} ${color}
${font 文泉驿正黑:size=10}总计: ${color #8844ee}${font PizzaDude Bullets:size=10}M${font} ${totalup eth0} ${alignr}${color #22ccff}${font PizzaDude Bullets:size=10}S${font} ${totaldown eth0}
${color slate grey}${font} Up: ${color #8844ee}${upspeed eth0}/s ${alignr}${color slate grey}Down: ${color #22ccff}${downspeed eth0}/s
${voffset -4}$color${upspeedgraph eth0 30,100 8844ee 22ccff}$alignr${downspeedgraph eth0 30,100 8844ee 22ccff}
${voffset -12}$color${font Martin Vogel's Symbols:size=20}k${font}${color slate grey} ${voffset -8}E-Mail: OMG@gmail.com $color
${font 文泉驿正黑:size=10}$alignr 有 ${color green}${texeci 7200 ~/scripts/check_gmail.sh}$color 封新邮件,来自:
${voffset -4}${font DejaVu Sans:size=8}${execi 7200 ~/scripts/gmail.pl `~/scripts/check_gmail.sh`}
2ndconkyrc :
天气预报
background no
override_utf8_locale yes
font DejaVu Sans:size=9
xftfont DejaVu Sans:size=9
use_xft yes
xftalpha 0.1
update_interval 1.5
total_run_times 0
own_window yes
#own_window_class Conky
own_window_type desktop
own_window_transparent no
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
minimum_size 165 5
maximum_width 225
alignment top_left
gap_x 50
gap_y 70
#no_buffers yes
cpu_avg_samples 2
uppercase no
use_spacer none
out_to_console no
default_color moccasin
default_shade_color black
default_outline_color grey90
TEXT
${font 文泉驿正黑:size=12}${time %x} ${time %A}$font
${font 文泉驿正黑:size=10}${exec ~/scripts/lunardate.py }$font
${execpi 10800 ~/scripts/weatherimg.sh}
${font Yahei Mono:size=10}${color green}天气预报 $color
今天:${execi 10800 ~/scripts/conkytq.sh 1}
明天:${execi 10800 ~/scripts/conkytq.sh 2}
后天:${execi 10800 ~/scripts/conkytq.sh 3}
${voffset -8}${stippled_hr}
${voffset -5}${color}${font Martin Vogel's Symbols:size=12}U${font}${color slate grey} UpTime:$alignr${color }$uptime
${color}${font StyleBats:size=11}Q${font}${color slate grey} Kernel:$alignr${color }$kernel
${font StyleBats:size=10}j${font Yahei Mono:size=9} 电池:$alignr ${font}$battery
${color}${font StyleBats:size=10}A${font}${color slate grey} CPU temperature: $alignr${color}${acpitemp}℃
${color}usage: $alignc Core0: ${cpu cpu1} % $alignr Core1: ${cpu cpu2} %
${color slate grey}Disk Read: ${color #8844ee}${diskio_read /dev/sda} $alignr ${color slate grey} Write: ${color #22ccff}${diskio_write /dev/sda}
$if_mpd_playing${color}${voffset -4}${stippled_hr}
${font Yahei Mono:size=10}${color green} 音乐播放器:MPD $color
${voffset -4}$mpd_artist $alignr (${mpd_album})
$mpd_title
${font}${execi 2 ~/scripts/mpd.awk} ${color #88aadd}${mpd_bar 4,150} ${color} $mpd_percent %
${execi 1 mpc | grep '#' | cut -c 10- | cut -d "(" -f1} ${font Webdings:size=12}X${font}:${mpd_vol} %
${font Yahei Mono:size=10}码率: ${mpd_bitrate}kbps 随机:$mpd_random 循环:$mpd_repeat $endif
override_utf8_locale yes
font DejaVu Sans:size=9
xftfont DejaVu Sans:size=9
use_xft yes
xftalpha 0.1
update_interval 1.5
total_run_times 0
own_window yes
#own_window_class Conky
own_window_type desktop
own_window_transparent no
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
minimum_size 165 5
maximum_width 225
alignment top_left
gap_x 50
gap_y 70
#no_buffers yes
cpu_avg_samples 2
uppercase no
use_spacer none
out_to_console no
default_color moccasin
default_shade_color black
default_outline_color grey90
TEXT
${font 文泉驿正黑:size=12}${time %x} ${time %A}$font
${font 文泉驿正黑:size=10}${exec ~/scripts/lunardate.py }$font
${execpi 10800 ~/scripts/weatherimg.sh}
${font Yahei Mono:size=10}${color green}天气预报 $color
今天:${execi 10800 ~/scripts/conkytq.sh 1}
明天:${execi 10800 ~/scripts/conkytq.sh 2}
后天:${execi 10800 ~/scripts/conkytq.sh 3}
${voffset -8}${stippled_hr}
${voffset -5}${color}${font Martin Vogel's Symbols:size=12}U${font}${color slate grey} UpTime:$alignr${color }$uptime
${color}${font StyleBats:size=11}Q${font}${color slate grey} Kernel:$alignr${color }$kernel
${font StyleBats:size=10}j${font Yahei Mono:size=9} 电池:$alignr ${font}$battery
${color}${font StyleBats:size=10}A${font}${color slate grey} CPU temperature: $alignr${color}${acpitemp}℃
${color}usage: $alignc Core0: ${cpu cpu1} % $alignr Core1: ${cpu cpu2} %
${color slate grey}Disk Read: ${color #8844ee}${diskio_read /dev/sda} $alignr ${color slate grey} Write: ${color #22ccff}${diskio_write /dev/sda}
$if_mpd_playing${color}${voffset -4}${stippled_hr}
${font Yahei Mono:size=10}${color green} 音乐播放器:MPD $color
${voffset -4}$mpd_artist $alignr (${mpd_album})
$mpd_title
${font}${execi 2 ~/scripts/mpd.awk} ${color #88aadd}${mpd_bar 4,150} ${color} $mpd_percent %
${execi 1 mpc | grep '#' | cut -c 10- | cut -d "(" -f1} ${font Webdings:size=12}X${font}:${mpd_vol} %
${font Yahei Mono:size=10}码率: ${mpd_bitrate}kbps 随机:$mpd_random 循环:$mpd_repeat $endif
weatherimg.sh :
代码
#!/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 "发布今日气象指数" | cut -f1 | sed 's/ *//'`
head -n $end $baidutq| tail -n 6> $weather
# iconv -f gbk -t utf-8 $weather > $weather # 转化为utf-8编码
cnd=`~/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='thunderShower.png' ;;
'大雪')
cond='SnowHeavy.png' ;;
'雨加雪')
cond='RainMixedSnow.png' ;;
'中雪')
cond='Snow.png' ;;
'小雪')
cond='SnowLight.png' ;;
esac
prefstr='${image ~/download/weather_images/'
poststr=' -s 40x40 -p 160,40 }'
echo $prefstr$cond$poststr
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 "发布今日气象指数" | cut -f1 | sed 's/ *//'`
head -n $end $baidutq| tail -n 6> $weather
# iconv -f gbk -t utf-8 $weather > $weather # 转化为utf-8编码
cnd=`~/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='thunderShower.png' ;;
'大雪')
cond='SnowHeavy.png' ;;
'雨加雪')
cond='RainMixedSnow.png' ;;
'中雪')
cond='Snow.png' ;;
'小雪')
cond='SnowLight.png' ;;
esac
prefstr='${image ~/download/weather_images/'
poststr=' -s 40x40 -p 160,40 }'
echo $prefstr$cond$poststr
conkytq.sh :
#!/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
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