码迷,mamicode.com
首页 > 其他好文 > 详细

一个简单的conky

时间:2018-03-31 13:18:42      阅读:212      评论:0      收藏:0      [点我收藏+]

标签:conky   1.10.x   

一个简单的conky,支持 1.10.x版本
技术分享图片

conkyrc代码如下

#code by ogre25,ihope no dead.never parents.
conky.config = {
    alignment = ‘top_right‘,
    background = false,
    font = ‘Sans:size=8‘,
    use_xft = true,
    xftalpha = 0.9,
    update_interval = 1,
    total_run_times = 0,
    own_window = true,
    own_window_type = ‘normal‘,
        own_window_argb_visual = true,
        own_window_transparent = true,
    own_window_class = ‘conky‘,
    own_window_hints = ‘undecorated,below,sticky,skip_taskbar,skip_pager‘,
    double_buffer = true,
    minimum_height = 1000,
    minimum_width = 290,
    maximum_width = 290,
    draw_shades = true,
    draw_outline = false,
    draw_borders = false,
    draw_graph_borders = true,
    default_color = ‘white‘,
    default_shade_color = ‘white‘,
    default_outline_color = ‘white‘,
    color1 = ‘green‘,
    color2 = ‘blue‘,
    color3 = ‘black‘,
    color4 = ‘yellow‘,
    gap_x = 1900,
    gap_y = 1900,
    alignment = ‘bl‘,
    no_buffers = true,
    uppercase = false,
    cpu_avg_samples = 2,
    override_utf8_locale = false,
    uppercase = true,
}

conky.text = [[
${color4}CLOCK${color}
${hr 1}
${voffset -2}${alignc 38}${color1}${font Liberation Sans:style=Bold:size=30}${time %H:%M}${font}${color}
${voffset 10}${alignc}${time %d %B %Y}${voffset -6}
${hr 1}
${color4}CPU USAGE${color}
${hr 1}
Core0@${freq 1} MHz ${alignr}${cpu cpu0}%
${color}${cpubar cpu0 4 }${color}
Core1@${freq 2} MHz ${alignr}${cpu cpu1}%
${color}${cpubar cpu1 4 }${color}
Core2@${freq 3} MHz ${alignr}${cpu cpu2}%
${color}${cpubar cpu2 4 }${color}
Core3@${freq 4} MHz ${alignr}${cpu cpu3}%
${color}${cpubar cpu3 4 }${color}
Core4@${freq 5} MHz ${alignr}${cpu cpu4}%
${color}${cpubar cpu4 4 }${color}
Core5@${freq 6} MHz ${alignr}${cpu cpu5}%
${color}${cpubar cpu5 4 }${color}
Core6@${freq 7} MHz ${alignr}${cpu cpu6}%
${color}${cpubar cpu6 4 }${color}
Core7@${freq 8} MHz ${alignr}${cpu cpu7}%
${color}${cpubar cpu7 4 }${color}
Core8@${freq 9} MHz ${alignr}${cpu cpu8}%
${color}${cpubar cpu8 4 }${color}
Core9@${freq 10} MHz ${alignr}${cpu cpu9}%
${color}${cpubar cpu9 4 }${color}
Core10@${freq 11} MHz ${alignr}${cpu cpu10}%
${color}${cpubar cpu10 4 }${color}
Core11@${freq 12} MHz ${alignr}${cpu cpu11}%
${color}${cpubar cpu11 4 }${color}
${hr 1}
${color4}MEM USAGE${color}
${hr 1}
Ram ${alignr}$mem / $memmax ($memperc%)
${color}${membar 4}${color}
${hr 1}
${color4}PROCESS${color}
${hr 1}
${color4}Highest CPU $alignr CPU% MEM%${color}
${top name 1}$alignr${top cpu 1}${top mem 1}
${top name 2}$alignr${top cpu 2}${top mem 2}
${top name 3}$alignr${top cpu 3}${top mem 3}
${top name 4}$alignr${top cpu 4}${top mem 4}
${color4}Highest MEM $alignr CPU% MEM%${color}
${top_mem name 1}$alignr${top_mem cpu 1}${top_mem mem 1}
${top_mem name 2}$alignr${top_mem cpu 2}${top_mem mem 2}
${top_mem name 3}$alignr${top_mem cpu 3}${top_mem mem 3}
${top_mem name 4}$alignr${top_mem cpu 4}${top_mem mem 4}
${hr 1}
${color4}NETWORK${color}
${hr 1}
Eth: ${addr eno1}
Down ${downspeed eno1}/s ${alignr}Up ${upspeed eno1}/s
${color3}${downspeedgraph eno1 32,107 ff0000 0000ff} ${alignr}${color3}${upspeedgraph eno1 32,107 ff0000 0000ff}
${color}Total ${totaldown eno1} ${alignr}Total ${totalup eno1}${color}
${color4}Port(s)${alignr}#Connections${color}
${color4} Inbound: ${tcp_portmon 1 32767 count}  Outbound: ${tcp_portmon 32768 61000 count}${alignr}ALL: ${tcp_portmon 1 65535 count}${color}
${color4}Inbound Connection ${alignr} Local Service/Port${color}
 ${tcp_portmon 1 32767 rhost 0} ${alignr} ${tcp_portmon 1 32767 lservice 0}
 ${tcp_portmon 1 32767 rhost 1} ${alignr} ${tcp_portmon 1 32767 lservice 1}
 ${tcp_portmon 1 32767 rhost 2} ${alignr} ${tcp_portmon 1 32767 lservice 2}
 ${tcp_portmon 1 32767 rhost 3} ${alignr} ${tcp_portmon 1 32767 lservice 3}
${color4}Outbound Connection ${alignr} Remote Service/Port$color${color}
 ${tcp_portmon 32768 61000 rhost 0} ${alignr} ${tcp_portmon 32768 61000 rservice 0}
 ${tcp_portmon 32768 61000 rhost 1} ${alignr} ${tcp_portmon 32768 61000 rservice 1}
 ${tcp_portmon 32768 61000 rhost 2} ${alignr} ${tcp_portmon 32768 61000 rservice 2}
 ${tcp_portmon 32768 61000 rhost 3} ${alignr} ${tcp_portmon 32768 61000 rservice 3}
${hr 1}
${color4}WEATHER${color}
${hr 1}
${execi 300 curl -s "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%3D2159908%20and%20u%3D%27c%27&format=xml&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys" -o ~/.cache/weather.xml}
${goto 2}${voffset 0}${font Liberation Sans:size=36}${execi 300 grep "yweather:condition" ~/.cache/weather.xml | grep -o "temp=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}?C${font}                             ${font Liberation Sans:style=Bold:size=12}${execi 300 grep "yweather:location" ~/.cache/weather.xml | grep -o "city=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*"}${font}
${goto 6}${voffset 14}${font Liberation Sans:size=12}${execi 300 grep "yweather:condition" ~/.cache/weather.xml | grep -o "text=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | sed -n "1p"}${font}
${voffset 30}${alignc 117}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk ‘NR==1‘ | tr ‘[a-z]‘ ‘[A-Z]‘}
${voffset -13}${alignc 40}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk ‘NR==2‘ | tr ‘[a-z]‘ ‘[A-Z]‘}
${voffset -13}${alignc -37}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "day=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk ‘NR==3‘ | tr ‘[a-z]‘ ‘[A-Z]‘}
${voffset 63}${alignc 114}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk ‘NR==1‘}?C/${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk ‘NR==1‘}?C
${voffset -8}${alignc 44}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk ‘NR==2‘}?C/${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk ‘NR==2‘}?C
${voffset -8}${alignc -33}${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "low=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk ‘NR==3‘}?C/${execi 300 grep "yweather:forecast" ~/.cache/weather.xml | grep -o "high=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk ‘NR==3‘}?C
${execi 300 cp -f ~/.conky/icons/$(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 15,970 -s 32x32}${execi 300 cp -f ~/.conky/icons/$(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 93,970 -s 32x32}${execi 300 cp -f ~/.conky/icons/$(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 169,970 -s 32x32}]]

一个简单的conky

标签:conky   1.10.x   

原文地址:http://blog.51cto.com/10973437/2093309

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!