conky
openSUSE    2017-01-17 22:42:53    69    0    0
tianwaifeixian   openSUSE
conky.config = {  
    alignment = 'top_right',  
      
    background = false,  
      
    border_width = 1,  
      
    cpu_avg_samples = 2,  
    net_avg_samples = 2,  
      
    use_xft = true,  
    -- Xft font when Xft is enabled  
    font = 'Sans:size=9',  
    -- Text alpha when using Xft  
    xftalpha = 0.8,  
      
    default_color = 'black',  
    default_outline_color = 'black',  
    default_shade_color = '',  
      
    draw_borders = false,  
    draw_graph_borders = true,  
    draw_outline = false,  
    draw_shades = false,  
  
    gap_x = 10,  
    gap_y = 1,  
    minimum_height = 5,  
    minimum_width = 100,
    maximum_width = 200,  
      
    no_buffers = true,  
    out_to_console = false,  
    out_to_stderr = false,  
    extra_newline = false,  
  
    double_buffer = true,  
    -- Create own window instead of using desktop (required in nautilus)  
    own_window = true,  
    own_window_class = 'Conky', 
    own_window_colour = white , 
    own_window_argb_visual = true,  
    own_window_transparent = true,  
    own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',  
    own_window_type = 'normal',  
  
    stippled_borders = 0,  
    update_interval = 1.0,  
    uppercase = false,  
    use_spacer = 'none',  
    show_graph_scale = false,  
    show_graph_range = false  
}  
  
conky.text = [[  
${color}${font Cantarell:size=12}Date: ${color white}${time %B%d,%A}
${color}Time: ${color white}${time %k:%M:%S}${alignr}${color}
${color yellow}系统信息:${color}  
内核版本: $alignr$kernel  
开机时长: $alignr$uptime  
温度: $alignr$acpitemp°C 
CPU ${alignr}${cpu cpu0}%: ${alignr}${freq dyn} MHz   
${cpubar 4 cpu0}
RAM ${alignr}$mem / $memmax ($memperc%)  
${membar 4}  
${color yellow}硬盘分区:${color} 
/root   ${fs_used /}/${fs_size /}${alignr}${fs_used_perc /}%
${fs_bar /}
/home   ${fs_used /home}/${fs_size /home}${alignr}${fs_used_perc /home}%
${fs_bar /home}
/var    ${fs_used /var}/${fs_size /var}${alignr}${fs_used_perc /var}%
${fs_bar /var}
/opt   ${fs_used /opt}/${fs_size /opt}${alignr}${fs_used_perc /opt}%
${fs_bar /opt}
${color yellow}无线网络${color}  
Down${downspeed wlan0}/s ${alignr}Up ${upspeed wlan0}/s  
${downspeedgraph wlan0 8,100} ${alignr}${upspeedgraph wlan0 8,100}  
Total ${totaldown wlan0} ${alignr}Total ${totalup wlan0}  
${color yellow}有线网络${color} 
Down ${downspeed eth0}/s ${alignr}Up ${upspeed 0}/s  
${downspeedgraph eth0 8,100} ${alignr}${upspeedgraph eth0 8,100}  
Total ${totaldown eth0} ${alignr}Total ${totalup eth0}
${color #2E8B57}天气状况${color}${color #87CEEB}${hr 1}${color}
${execpi (segundos) brweather --imagem(numero de 1 a 7)=C(dia: N ou 1-7) -p (posição) -s 60x60 (tamanho)}
${execpi 3600 brweather --imagem1=CN -p 100,90 -s 60x60}
${execpi 3600 brweather --imagem1=C2 -p 70,200 -s 90x90}
${execpi 3600 brweather --imagem1=C4 -p 165,160 -s 30x30}
]]

83到87的天气尽管从https://downloads.sourceforge.net/brweather下载过来配置好了也从http://openweathermap.org 查到了城市ID配置到了$HOME/.brweather.conf

BUT:

CONKY依然显示error

~~~~~~~~~~~~``

调整了一下看到了 不过还是不是很好

${color #2E8B57}天气状况${color}${color #FFFFFF}${hr 1}${color}
${execpi (segundos) brweather --imagem(numero de 1 a 7)=C(dia: N ou 1-7) -p (posição) -s 60x60 (tamanho)}
${execpi 3600 brweather --imagem1=CN -p 10,600 -s 60x60}
${execpi 3600 brweather --imagem1=C2 -p 70,600 -s 90x90}
${execpi 3600 brweather --imagem1=C4 -p 150,550 -s 60x60}

问题解决啦一半

可执行文件brweather 的源代码

209行:

elif [ $OPEN = "1" ] ; then
 wget -q -T $TIME -O ~/.brweather/cache/open1_A "http://api.openweathermap.org/data/2.5/weather?id=$OPEN_ID&units=metric&APPID=$KEY"​

打开http://api.openweathermap.org/data/2.5/weather?id=1808926这个地址显示

{"cod":401, "message": "Invalid API key. Please see http://openweathermap.org/faq#error401 for more info."}​


然后访问:
http://openweathermap.org/faq
得到如下:

Q: API calls return an error 401
A: Starting from 9 October 2015 our API requires a valid APPID for access. Note that this does not mean that our API is subscription-only now - please take a minute to register a free account to receive a key.​


意思要注册啊
注册成功 十分钟生效
https://home.openweathermap.org/api_keys
KEY="232a0----------487"

访问地址得到数据:
http://api.openweathermap.org/data/2.5/weather?q=London,uk&lang=zh_cn&APPID=232a04cf4f71608abc959fd9e769f487

{"coord":{"lon":-0.13,"lat":51.51},"weather":[{"id":721,"main":"Haze","description":"haze","icon":"50n"},{"id":701,"main":"Mist","description":"mist","icon":"50n"}],"base":"stations","main":{"temp":270.34,"pressure":1038,"humidity":75,"temp_min":268.15,"temp_max":273.15},"visibility":4500,"wind":{"speed":1.5},"clouds":{"all":80},"dt":1484715000,"sys":{"type":1,"id":5091,"message":0.0134,"country":"GB","sunrise":1484726178,"sunset":1484756779},"id":2643743,"name":"London","cod":200}​

现在就剩下怎么把它读出来啦

上一篇: BrWeather

下一篇: 纽曼纽扣cm810救黑砖经历

69 人读过
立即登录, 发表评论.
没有帐号? 立即注册
0 条评论
文档导航