Conky

Conky 是一款類似 Mac OS X GeekTool 的桌面小工具 (其實 Conky 比較早出生,不過我比較晚發現 XD)。

他們都可以透過一些內建的 Function 或者寫 shell script 來顯示電腦的狀態(或者想印在桌面的狀態),例如我現在的桌面是這樣的

大致上就是顯示天氣,網路速度、流量,CPU、記憶體、硬碟等使用率,然後還有 CPU 溫度跟風扇的資訊,最下面有 parse RSS (Gentoo Security) 的部分

參考網路設計師 Conky Google Now 這個主題

小弟合併了官網其他人貢獻的設定,稍微修改了一下

從剛剛那個 Google Now 的 theme 下載 conky_google_now_by_satya164-d628cih.zip 解壓縮之後會有個 .conky-google-now 複製到家目錄 (也就是 ~/.conky-google-now) 底下即可

以下是我的設定 直接存檔成 ~/.conkyrc 然後用 conkyrc -d 啟動就可以看到程式了

# Conky Google Now style #
# Conky settings #
background yes
update_interval 1
double_buffer yes
no_buffers yes
# Window specifications #
own_window yes
own_window_type normal
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_title
own_window_colour FFFFFF
minimum_size 180 500
#maximum_width 1200
# Alignment #
#alignment tr
alignment top_left
gap_x 970
gap_y 100
border_inner_margin 15
border_outer_margin 0
# Graphics settings #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
# Text settings #
use_xft yes
xftalpha 0
xftfont Open Sans Light:size=10
override_utf8_locale yes
imlib_cache_size 0
# Color scheme #
default_color 666666
color1 0099CC
color2 9933CC
color3 669900
color4 FF8800
color5 CC0000
color6 AAAAAA
color7 DDDDDD
TEXT
${execi 300 curl -s "http://weather.yahooapis.com/forecastrss?w=9807&u=c" -o ~/.cache/weather.xml}${font Open Sans Light:size=15}${execi 300 grep "yweather:location" ~/.cache/weather.xml | grep -o "city=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}, ${execi 300 grep "yweather:location" ~/.cache/weather.xml | grep -o "country=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}${font}
${font Open Sans Light:size=70}${alignr}${execi 300 grep "yweather:condition" ~/.cache/weather.xml | grep -o "temp=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}°${font}${voffset -35}
${execi 300 cp -f ~/.conky-google-now/$(grep "yweather:condition" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*").png ~/.cache/weather.png}${image ~/.cache/weather.png -p 0,45 -s 60x60}
${execi 300 grep "yweather:condition" ~/.cache/weather.xml | grep -o "text=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | tr '[a-z]' '[A-Z]'}
${image ~/.conky-google-now/wind.png -p 0,135 -s 15x15}${goto 35}${execi 300 grep "yweather:wind" ~/.cache/weather.xml | grep -o "speed=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}${execi 300 grep "yweather:units" ~/.cache/weather.xml | grep -o "speed=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}
${image ~/.conky-google-now/humidity.png -p 0,155 -s 15x15}${goto 35}${execi 300 grep "yweather:atmosphere" ~/.cache/weather.xml | grep -o "humidity=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}%${voffset 15}
${goto 18}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==1' | tr '[a-z]' '[A-Z]'}${goto 88}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2' | tr '[a-z]' '[A-Z]'}${goto 158}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3' | tr '[a-z]' '[A-Z]'}${goto 228}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==4' | tr '[a-z]' '[A-Z]'}${goto 298}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==5' | tr '[a-z]' '[A-Z]'}
${execi 300 cp -f ~/.conky-google-now/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==1').png ~/.cache/weather-1.png}${image ~/.cache/weather-1.png -p 0,210 -s 30x30}${execi 300 cp -f ~/.conky-google-now/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2').png ~/.cache/weather-2.png}${image ~/.cache/weather-2.png -p 70,210 -s 30x30}${execi 300 cp -f ~/.conky-google-now/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3').png ~/.cache/weather-3.png}${image ~/.cache/weather-3.png -p 140,210 -s 30x30}${execi 300 cp -f ~/.conky-google-now/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==4').png ~/.cache/weather-4.png}${image ~/.cache/weather-4.png -p 210,210 -s 30x30}${execi 300 cp -f ~/.conky-google-now/$(grep "yweather:forecast" ~/.cache/weather.xml | grep -o "code=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==5').png ~/.cache/weather-5.png}${image ~/.cache/weather-5.png -p 280,210 -s 30x30}${voffset 20}
${goto 20}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==1'}°${goto 90}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2'}°${goto 160}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3'}°${goto 230}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==4'}°${goto 300}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==5'}°
${goto 20}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==1'}°${goto 90}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==2'}°${goto 160}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==3'}°${goto 230}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==4'}°${goto 300}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==5'}°
${color7}${hr}${color}
${if_existing /proc/net/route wlan0}
${color1}Up:${color} ${color3}${upspeed wlan0}${color}${alignr}${color1}Down:${color} ${color3}${downspeed wlan0}${color}
${upspeedgraph wlan0 32,135 FF8800 FF8800}${alignr}${downspeedgraph wlan0 32,135 FF8800 FF8800}
${color1}Sent:${color} ${color2}${totalup wlan0}${color}${alignr}${color1}Received:${color} ${color2}${totaldown wlan0}${color}
${else}${if_existing /proc/net/route wlan1}
${color1}Up:${color} ${color3}${upspeed wlan1}${color}${alignr}${color1}Down:${color} ${color3}${downspeed wlan1}${color}
${upspeedgraph wlan1 32,135 FF8800 FF8800}${alignr}${downspeedgraph wlan1 32,135 FF8800 FF8800}
${color1}Sent:${color} ${color2}${totalup wlan1}${color}${alignr}${color1}Received:${color} ${color2}${totaldown wlan1}${color}
${else}${if_existing /proc/net/route eth0}
${color1}Up:${color} ${color3}${upspeed eth0}${color}${alignr}${color1}Down:${color} ${color3}${downspeed eth0}${color}
${upspeedgraph eth0 32,135 FF8800 FF8800}${alignr}${downspeedgraph eth0 32,135 FF8800 FF8800}
${color1}Sent:${color} ${color2}${totalup eth0}${color}${alignr}${color1}Received:${color} ${color2}${totaldown eth0}${color}
${else}${if_existing /proc/net/route eth1}
${color1}Up:${color} ${color3}${upspeed eth1}${color}${alignr}${color1}Down:${color} ${color3}${downspeed eth1}${color}
${upspeedgraph eth1 32,135 FF8800 FF8800}${alignr}${downspeedgraph eth1 32,135 FF8800 FF8800}
${color1}Sent:${color} ${color2}${totalup eth1}${color}${alignr}${color1}Received:${color} ${color2}${totaldown eth1}${color}
${else}${if_existing /proc/net/route eth2}
${color1}Up:${color} ${color3}${upspeed eth2}${color}${alignr}${color1}Down:${color} ${color3}${downspeed eth2}${color}
${upspeedgraph eth2 32,135 FF8800 FF8800}${alignr}${downspeedgraph eth2 32,135 FF8800 FF8800}
${color1}Sent:${color} ${color2}${totalup eth2}${color}${alignr}${color1}Received:${color} ${color2}${totaldown eth2}${color}
${else}${if_existing /proc/net/route ppp0}
${color1}Up:${color} ${color3}${upspeed ppp0}${color}${alignr}${color1}Down:${color} ${color3}${downspeed ppp0}${color}
${upspeedgraph ppp0 32,135 FF8800 FF8800}${alignr}${downspeedgraph ppp0 32,135 FF8800 FF8800}
${color1}Sent:${color} ${color2}${totalup ppp0}${color}${alignr}${color1}Received:${color} ${color2}${totaldown ppp0}${color}
${else}${if_existing /proc/net/route ppp1}
${color1}Up:${color} ${color3}${upspeed ppp1}${color}${alignr}${color1}Down:${color} ${color3}${downspeed ppp1}${color}
${upspeedgraph ppp1 32,135 FF8800 FF8800}${alignr}${downspeedgraph ppp1 32,135 FF8800 FF8800}
${color1}Sent:${color} ${color2}${totalup ppp1}${color}${alignr}${color1}Received:${color} ${color2}${totaldown ppp1}${color}
${else}${if_existing /proc/net/route usb0}
${color1}Up:${color} ${color3}${upspeed usb0}${color}${alignr}${color1}Down:${color} ${color3}${downspeed usb0}${color}
${upspeedgraph usb0 32,135 FF8800 FF8800}${alignr}${downspeedgraph usb0 32,135 FF8800 FF8800}
${color1}Sent:${color} ${color2}${totalup usb0}${color}${alignr}${color1}Received:${color} ${color2}${totaldown usb0}${color}
${else}${if_existing /proc/net/route usb1}
${color1}Up:${color} ${color3}${upspeed usb1}${color}${alignr}${color1}Down:${color} ${color3}${downspeed usb1}${color}
${upspeedgraph usb1 32,135 FF8800 FF8800}${alignr}${downspeedgraph usb1 32,135 FF8800 FF8800}
${color1}Sent:${color} ${color2}${totalup usb1}${color}${alignr}${color1}Received:${color} ${color2}${totaldown usb1}${color}
${else}
Network disconnected
${color6}Connect to a network to see statistics${color}
${voffset 75}
${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}
${color7}${hr}${color}
${color1}System:
${color1} Uptime:${color3} $uptime ${color1}- Load:${color3} $loadavg
${color1} CPU Frequency:${color3} $freq_g
${color1} CPU Usage:${color3} $cpu% ${cpubar}
${color1}${cpugraph cpu0 32,330 FF8800 FF8800}
${color1} RAM Usage:${color3} $mem/$memmax - $memperc% ${color4}${membar}
${color1} Swap Usage:${color3} $swap/$swapmax - $swapperc% ${color4}${swapbar}
${color1} Processes:${color3} $processes ${color1}Running:${color3} $running_processes
${color7}${hr}${color}
${color1}File systems:
${color1}/ $color${fs_used /}/${fs_size /}${alignr}${color4}${fs_bar 5,120 /}
${color1}/mnt/ssd $color${fs_used /mnt/ssd}/${fs_size /mnt/ssd}${alignr}${color4}${fs_bar 5,120 /mnt/ssd}
${color7}${hr}${color}
${color1}Monitors $alignr CPU FAN
${color1} $alignr ${execi 30 sensors | grep 'CPU Temp' | cut -c22-25}°C ${execi 30 sensors | grep 'CPU FAN' | cut -c20-23} rpm
${color7}${hr}${color}
${color1}MPD: ${color3}${alignc}$mpd_artist - $mpd_title
${color1}$mpd_bar
${color1}${alignc}$mpd_status
${color7}${hr}${color}
${color1}CPU Top $alignr PID CPU%
${color1} ${top name 1} $alignr ${top pid 1} ${top cpu 1}
${color1} ${top name 2} $alignr ${top pid 2} ${top cpu 2}
${color1} ${top name 3} $alignr ${top pid 3} ${top cpu 3}
${color1}Mem Top $alignr PID MEM%
${color1} ${top_mem name 1} $alignr ${top_mem pid 1} ${top_mem mem 1}
${color1} ${top_mem name 2} $alignr ${top_mem pid 2} ${top_mem mem 2}
${color1} ${top_mem name 3} $alignr ${top_mem pid 3} ${top_mem mem 3}
${color7}${hr}${color}
${color1}Gentoo Linux Security Advisories:
${color1}${execi 300 /home/neoesque/bin/conky-rss.sh http://www.gentoo.org/rdf/en/glsa-index.rdf 5 1}
view raw .conkyrc hosted with ❤ by GitHub

最後面的 RSS 是取自 conky-rss.sh

另外天氣的部分如果要改地區,可以先到 Yahoo Weather 查詢地區碼,我的設定裡面是用 9807 也就是溫哥華的代碼