ConkyForecast examples (en)

From Conky PitStop

(Difference between revisions)
Jump to: navigation, search
Line 131: Line 131:
Image:Conkyforecast-7day2.png | <center>after</center>
Image:Conkyforecast-7day2.png | <center>after</center>
</gallery></center>
</gallery></center>
 +
 +
==7 Day Forecast (2)==
 +
'''Conky v1.7.1 & conkyForecast v2.08 - with Images'''
 +
 +
By : Bruce
 +
 +
With the coming of Conky v1.7.1, a must for what follows, comes the new, among others, '''$image''' command:
 +
imlib_cache_size
 +
Imlib2 image cache size, in bytes. Defaults to 4MiB. Increase this value if you use $image lots. Set to 0 to disable the image cache.
 +
 +
Personally I set it to '''“0″'''
 +
image
 +
(-p x,y) (-s WxH) (-n) (-f interval)
 +
 +
Renders an image from the path specified using Imlib2.
 +
Takes 4 optional arguments: a position, a size, a no-cache switch, and a cache flush interval.
 +
Changing the x,y position will move the position of the image, and changing the WxH will scale the image.
 +
If you specify the no-cache flag (-n), the image will not be cached.
 +
Alternately, you can specify the -f int switch to specify a cache flush interval for a particular image.
 +
Example: ${image /home/brenden/cheeseburger.jpg -p 20,20 -s 200×200} will render ‘cheeseburger.jpg’ at (20,20) scaled to 200×200 pixels.
 +
Conky does not make any attempt to adjust the position (or any other formatting) of images, they are just rendered as per the arguments passed.
 +
The only reason $image is part of the TEXT section, is to allow for runtime modifications, through $execp $lua_parse, or some other method.
 +
 +
And with these changes Conky is really growing up - teenager. Conky becomes an adult with Lua :D
 +
 +
One of the best uses I’ve made of the $image command is with Kaivalagi’s Python Script for weather: [http://ubuntuforums.org/showthread.php?t=869328 conkyForecast]. Grabbing the images from his other app: gtk-desktop-info (not conky) and combining them with conkyForecast was the work of stepper his first little HowTo can be seen [http://ubuntuforums.org/showpost.php?p=7897628&postcount=1690 here], which of course no longer applies as Kaivalagi has updated conkyForecast to include the images.
 +
 +
'''EDIT''': So why show stuff that no longer applies, two reasons, one is historical and the second is if someone read the links they may just get an idea for something new.
 +
 +
So today, conkyForecast (as of version: 2.08) can use the “font” type command to display:
 +
[--datatype=WF] – weather conditions,
 +
[--datatype=MF] – moon phases, and
 +
[--datatype=BF] – wind bearing
 +
 +
or the $image command
 +
${image [--datatype=WI] -p 12,0 -s 90×90} – weather conditions,
 +
${image [--datatype=MI] -p 12,0 -s 90×90} – moon phases, and
 +
${image [--datatype=BI] -p 12,0 -s 90×90} – wind bearing
 +
 +
The '''-p''' and '''-s''' elements of course will need to be changed to meet your specific needs.
 +
 +
'''It is important to remember:'''
 +
 +
Conky does not make any attempt to adjust the position (or any other formatting) of images, they are just rendered as per the arguments passed.
 +
 +
So the image commands can literally go anywhere under TEXT, I’ve experimented and added a few image commands directly after the first command under text '''on the same line so that they don’t add a line to conky'''.
 +
 +
'''For example:'''
 +
TEXT
 +
${font DejaVu Sans Mono:bold:size=10}${color5}${exec less ~/Conky/bruloo.txt}$color${image xxxx}${image xxxx}${image xxxx}
 +
${color6}${exec less ~/Conky/liloo.txt}$color$font
 +
next line
 +
 +
So at this point you can have a weather forecast that looks like these, mine on the left, stepper’s on the right:
 +
[[Image:conkyforecast-7day2-1.png | 500 px | center ]]
 +
 +
or the traditional “font” display:
 +
[[Image:conkyforecast-7day2-2.png | 500 px | center ]]
 +
 +
The only difference is in the commands used as seen above.
 +
 +
Here is my '''conkyforecast'''
 +
<pre>    background no
 +
    own_window yes
 +
    own_window_type override
 +
    own_window_transparent yes
 +
    own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
 +
    own_window_colour black
 +
    double_buffer yes
 +
    use_spacer left
 +
    override_utf8_locale yes
 +
    use_xft yes
 +
    font DejaVu Sans Mono:bold:size=9
 +
    xftfont DejaVu Sans Mono:bold:size=9
 +
    xftalpha 0.5
 +
    update_interval 5.0
 +
    uppercase no # set to yes if you want all text to be in uppercase
 +
    stippled_borders 0 #3
 +
    border_margin 0 #9
 +
    border_width 0 #10
 +
    default_outline_color black
 +
    default_shade_color black
 +
    draw_borders no
 +
    draw_outline yes # amplifies text if yes
 +
    draw_shades yes # shadecolor black
 +
 +
    default_color DCDCDC #Gainsboro
 +
    color0 7FFFD4 #Aquamarine
 +
    color1 CD5C5C #IndianRed #00CED1 DarkTurquoise #FFA07A LightSalmon #00FFFF Cyan
 +
    color2 FF8C00 #Darkorange #D2691E #Chocolate
 +
    color3 7FFF00 #Chartreuse
 +
    color4 778899 #LightSlateGrey
 +
    color5 FFDEAD #NavajoWhite
 +
    color6 00BFFF #DeepSkyBlue
 +
    # colours below used by colorize script
 +
    color7 48D1CC #MediumTurquoise
 +
    color8 FFFF00 #Yellow
 +
    color9 FF0000 #Red
 +
 +
    alignment bl # Aligned position on screen: tl, tr, tm, bl, br, bm, ml, mr
 +
    gap_x 5
 +
    gap_y -25 # because of the VOFFSET, the negative "gap_y" value brings conky back to the bottom of the screen.
 +
    text_buffer_size 6144 # 256 is the minimum
 +
    no_buffers yes # Subtract file system buffers from used memory?
 +
    short_units yes
 +
    pad_percents 2
 +
    imlib_cache_size 0
 +
 +
    TEXT
 +
    ${execpi 7200 ~/Conky/scripts/invisible_weather.sh}
 +
    ${voffset -50}${execpi 1800 conkyForecast --location=ARDF0127 --template=/home/bruloo/Conky/scripts/weather-7.template}</pre>
 +
 +
and my '''weather-7.template''' (using images)
 +
 +
<pre>    ${image [--datatype=WI] -p 12,0 -s 90x90}${goto 120}${color2}${font Zekton:size=20}[--datatype=DW --shortweekday --startday=0]:${color6} [--datatype=HT]
 +
    ${goto 120}${voffset -10}${font Zekton:bold:size=9}${color2}Sensación térmica: ${color6}[--datatype=LT --night]${font}
 +
    ${goto 120}${color2}Mín: ${color6}[--startday=0 --datatype=LT --night] ${color2}Máx: ${color9}[--startday=0 --datatype=HT --night]
 +
    ${goto 10}${voffset 10}${font Zekton:bold:size=11} ${color7}[--datatype=CC]${color}${font}
 +
    ${goto 10}${voffset 3}${color7}Visibilidad:${color8} [--datatype=VI]
 +
    ${goto 10}${voffset 3}${color7}P. de R.: ${color8}[--datatype=DP]${color}
 +
    ${goto 10}${voffset 3}${color7}Presión: ${color8}[--datatype=BR] - [--datatype=BD]${color}
 +
    ${goto 10}${voffset 3}${color7}Humedad: ${color8}[--datatype=HM] ${color7}UV: ${color8}[--datatype=UI] - ${color8}[--datatype=UT]
 +
    ${goto 15}${voffset 5}${color8}${font SunNMoon:size=50}n${font}${goto 70}${voffset -38}${font Arrows:size 20}${color3}b${color8}${font}[--datatype=SR]
 +
    ${goto 75}${color0}Luz: [--datatype=DL]
 +
    ${goto 70}${font Arrows:size 20}${color1}h${color8}${font}[--datatype=SS]${color}
 +
    ${image [--datatype=MI] -p 173,180 -s 55x55}
 +
    ${goto 15}${font DejaVu Sans Mono:bold:size=7}W:[--datatype=LU] -=- C:[--datatype=LF]${font}
 +
    ${image [--datatype=BI] -p 280,6 -s 80x80}
 +
    ${goto 280}${voffset -195}${color7}(${color8}[--datatype=WA]°${color7}) ${color8}[--datatype=WD]
 +
    ${goto 300}${voffset 5}${color8}[--datatype=WS]
 +
    ${voffset -110}${goto 380}${color2}[--datatype=DW --shortweekday --startday=1]:${color1}[--datatype=HT --hideunits --hidedegreesymbol --startday=1]${color}/${color7}[--datatype=LT --hideunits --hidedegreesymbol --startday=1]${goto 480}${color2}[--datatype=DW --shortweekday --startday=2]:${color1}[--datatype=HT --hideunits --hidedegreesymbol --startday=2]${color}/${color7}[--datatype=LT --hideunits --hidedegreesymbol --startday=2]${goto 580}${color2}[--datatype=DW --shortweekday --startday=3]:${color1}[--datatype=HT --hideunits --hidedegreesymbol --startday=3]${color}/${color7}[--datatype=LT --hideunits --hidedegreesymbol --startday=3]
 +
    ${image [--datatype=WI --startday=1] -p 380,20 -s 50x50}${image [--datatype=WI --startday=2] -p 480,20 -s 50x50}${image [--datatype=WI --startday=3] -p 580,20 -s 50x50}
 +
    ${voffset 30}${goto 380}${color7}Sol:${color3}[--datatype=SR --startday=1]${goto 480}${color7}Sol:${color3}[--datatype=SR --startday=2]${goto 580}${color7}Sol:${color3}[--datatype=SR --startday=3]
 +
    ${goto 380}${color7} :${color1}[--datatype=SS --startday=1]${color}${goto 480}${color7} :${color1}[--datatype=SS --startday=2]${color}${goto 580}${color7} :${color1}[--datatype=SS --startday=3]${color}
 +
    ${goto 380}${color7}Luz:${color8}[--datatype=DL --startday=1]${color}${goto 480}${color7}Luz:${color8}[--datatype=DL --startday=2]${color}${goto 580}${color7}Luz:${color8}[--datatype=DL --startday=3]${color}
 +
    ${voffset 10}${color8}${goto 280}${cpubar cpu3 1,370}${color}
 +
    ${voffset 10}${goto 280}${color2}[--datatype=DW --shortweekday --startday=4]:${color1}[--datatype=HT --hideunits --hidedegreesymbol --startday=4]${color}/${color7}[--datatype=LT --hideunits --hidedegreesymbol --startday=4]${goto 380}${color2}[--datatype=DW --shortweekday --startday=5]:${color1}[--datatype=HT --hideunits --hidedegreesymbol --startday=5]${color}/${color7}[--datatype=LT --hideunits --hidedegreesymbol --startday=5]${goto 480}${color2}[--datatype=DW --shortweekday --startday=6]:${color1}[--datatype=HT --hideunits --hidedegreesymbol --startday=6]${color}/${color7}[--datatype=LT --hideunits --hidedegreesymbol --startday=6]${goto 580}${color2}[--datatype=DW --shortweekday --startday=7]:${color1}[--datatype=HT --hideunits --hidedegreesymbol --startday=7]${color}/${color7}[--datatype=LT --hideunits --hidedegreesymbol --startday=7]
 +
    ${image [--datatype=WI --startday=4] -p 280,160 -s 50x50}${image [--datatype=WI --startday=5] -p 380,160 -s 50x50}${image [--datatype=WI --startday=6] -p 480,160 -s 50x50}${image [--datatype=WI --startday=7] -p 580,160 -s 50x50}
 +
    ${voffset 35}${goto 280}${color7}Sol:${color3}[--datatype=SR --startday=4]${goto 380}${color7}Sol:${color3}[--datatype=SR --startday=5]${goto 480}${color7}Sol:${color3}[--datatype=SR --startday=6]${goto 580}${color7}Sol:${color3}[--datatype=SR --startday=7]
 +
    ${goto 280}${color7} :${color1}[--datatype=SS --startday=4]${color}${goto 380}${color7} :${color1}[--datatype=SS --startday=5]${color}${goto 480}${color7} :${color1}[--datatype=SS --startday=6]${color}${goto 580}${color7} :${color1}[--datatype=SS --startday=7]${color}
 +
    ${goto 280}${color7}Luz:${color8}[--datatype=DL --startday=4]${color}${goto 380}${color7}Luz:${color8}[--datatype=DL --startday=5]${color}${goto 480}${color7}Luz:${color8}[--datatype=DL --startday=6]${color}${goto 580}${color7}Luz:${color8}[--datatype=DL --startday=7]${color}</pre>
 +
 +
Or if you prefer : '''steppers template'''
 +
<pre>    ${image [--datatype=WI] -p 12,0 -s 90x90}${image [--datatype=MI] -p 12,80 -s 50x50}
 +
    ${voffset 55}${goto 25}${color3}[--datatype=HT --hideunits --centeredwidth=3]/[--datatype=LT --hideunits --centeredwidth=3]
 +
    ${voffset -70}${goto 120}${color1}${font Bitstream Vera Sans Mono:style=Bold:size=11}[--datatype=CT]${font}
 +
    ${voffset 10}${goto 120}${color2}Station: ${color1}Buenos Aires, Arg
 +
    ${goto 120}${color2}Rain: ${color1}[--datatype=PC]
 +
    ${goto 120}${color2}UV: ${color1}[--datatype=UI] - [--datatype=UT]
 +
    ${goto 120}${color2}Humidity: ${color1}[--datatype=HM]
 +
    ${goto 120}${color2}Dew Point: ${color1}[--datatype=DP]
 +
    ${goto 120}${color2}Sunrise/Set: ${color1}[--datatype=SR] / [--datatype=SS]
 +
    ${goto 120}${color2}Bar: ${color1}[--datatype=BR] - [--datatype=BD]
 +
    ${goto 120}${color2}Moon: ${color1}[--datatype=MP]
 +
    ${color2}${font Bitstream Vera Sans Mono:size=7}${goto 120}Last Update: [--datatype=LU]${font}
 +
    ${voffset 5}${goto 32}[--datatype=DW --startday=1 --shortweekday]${goto 80}[--datatype=DW --startday=2 --shortweekday]${goto 124}[--datatype=DW --startday=3 --shortweekday]${goto 172}[--datatype=DW --startday=4 --shortweekday]${goto 220}[--datatype=DW --startday=5 --shortweekday]${goto 268}[--datatype=DW --startday=6 --shortweekday]${goto 316}[--datatype=DW --startday=7 --shortweekday]
 +
    ${image [--datatype=WI --startday=1] -p 12,160 -s 40x40}${image [--datatype=WI --startday=2] -p 60,160 -s 40x40}${image [--datatype=WI --startday=3] -p 108,160 -s 40x40}${image [--datatype=WI --startday=4] -p 156,160 -s 40x40}${image [--datatype=WI --startday=5] -p 204,160 -s 40x40}${image [--datatype=WI --startday=6] -p 252,160 -s 40x40}${image [--datatype=WI --startday=7] -p 300,160 -s 40x40}
 +
    ${voffset 24}${goto 27}${color3}[--datatype=HT --startday=1 --hideunits --centeredwidth=3]/[--datatype=LT --startday=1 --hideunits --centeredwidth=3]${goto 75}[--datatype=HT --startday=2 --hideunits --centeredwidth=3]/[--datatype=LT --startday=2 --hideunits --centeredwidth=3]${goto 119}[--datatype=HT --startday=3 --hideunits --centeredwidth=3]/[--datatype=LT --startday=3 --hideunits --centeredwidth=3]${goto 167}[--datatype=HT --startday=4 --hideunits --centeredwidth=3]/[--datatype=LT --startday=4 --hideunits --centeredwidth=3]${goto 215}[--datatype=HT --startday=5 --hideunits --centeredwidth=3]/[--datatype=LT --startday=5 --hideunits --centeredwidth=3]${goto 263}[--datatype=HT --startday=6 --hideunits --centeredwidth=3]/[--datatype=LT --startday=6 --hideunits --centeredwidth=3]${goto 311}[--datatype=HT --startday=7 --hideunits --centeredwidth=3]/[--datatype=LT --startday=7 --hideunits --centeredwidth=3]</pre>
 +
 +
Hope you find this useful.

Revision as of 16:59, 26 March 2011

Contents

conkyForecast.py examples

 Language   English   Français   


By Kaivalagi

Conkyforecast-kaivalagi.jpg

Here's my current setup, ran using :

conky -c /home/mark/.scripts/conky/conky_forecast

Both files, conkyrc and template are in the archive : tar.gz


Opaque.png is just a 1x1 pixel semi-transparent png file, to shade the background with … that is purely optional.

Run as is this setup will put the forecast strip on the right hand side of the desktop. If you don't want so many days ahead just remove some of the settings from the end of the template file to reduce the amount shown.


Note: this setup requires conky version 1.7.2 or higher with image tag support to use the images rather than the fonts.

Hope it gives you inspiration if nothing else.

By Crinos512

Conkyforecast-crinos512.png

This is my weather template for conkyForecast. I will let someone else explain that gem better at conkyForecast, but it basically does what my other parts do: generate and return conky code to conky.

Don’t forget to check out the conkyLatLong.py by Kaivalagi as well.

weather.template

${color1}${stippled_hr 1}${color}
${voffset -6}  Weather: ( ${color2}${execi 3600 python ~/.conky/conkyparts/conkyLatLong.py}${color} )
${voffset -6}${color1}${stippled_hr 1}${color}
    Conditions: ${color2}[--datatype=CC]${color}
    Currrent temp: ${color2}[--datatype=HT --imperial]${color} ( Feels like ${color2}[--datatype=LT --imperial]${color} )
    Chance of rain: ${color2}[--datatype=PC]${color}
    Winds at ${color2}[--datatype=WS --imperial]${color} Gusting to ${color2}[--datatype=WG --imperial]${color}
${voffset -46}${goto 240}${font Arrows:size=46}${color3}[--datatype=BF]${color}${font}
${color6}${voffset -46}${goto 241}${font ConkyWeather:size=46}[--datatype=WF]${font}${color}
${voffset -58}${goto 240}${font ConkyWeather:size=46}[--datatype=WF]${font}
${color6}${voffset -46}${goto 321}${font Moon Phases:size=32}[--datatype=MF]${font}${color}
${voffset -43}${goto 320}${font Moon Phases:size=32}[--datatype=MF]${font}
  [--datatype=DW --startday=1]: ${color1}${hr 1}${color}
    Conditions will be ${color2}[--datatype=CT --startday=1].${color}${alignr}Rain Chance: ${color2}[--datatype=PC --startday=1]${color}   
    Winds will come from the ${color2}[--datatype=WD --startday=1]${color} at ${color2}[--datatype=WS --startday=1 --imperial].${color}${alignr}Humidity: ${color2}[--datatype=HM --startday=1]${color}   
    Sunrise: ${color2}[--datatype=SR --startday=1]${color}${alignr}Sunset: ${color2}[--datatype=SS --startday=1]${color}   
    Pollen Count: ${color2}${execi 3600 curl --silent -q -d "affiliateid=6176&zip=73034" http://www.pollen.com/forecast.asp | cut -d'|' -f5} / 12${color}
      ( ${color2}${execi 3600 curl --silent -q -d "affiliateid=6176&zip=73034" http://www.pollen.com/forecast.asp | cut -d'|' -f11}${color} )
  Four day forecast: ${color1}${hr 1}${color}
${color2}${font Liberation Mono:size=8}${goto 20}[--datatype=DW --startday=1]${goto 110}[--datatype=DW --startday=2]${goto 200}[--datatype=DW --startday=3]${goto 290}[--datatype=DW --startday=4]${font}${color}
${font Liberation Mono:size=8}${goto 20}[--datatype=HT --startday=1 --imperial]/[--datatype=LT --startday=1 --imperial]${goto 110}[--datatype=HT --startday=2 --imperial]/[--datatype=LT --startday=2 --imperial]${goto 200}[--datatype=HT --startday=3 --imperial]/[--datatype=LT --startday=3 --imperial]${goto 290}[--datatype=HT --startday=4 --imperial]/[--datatype=LT --startday=4 --imperial]$font
${color3}${font Arrows:size=36}${goto 20}[--datatype=BF --startday=1]${font Liberation Sans:size=8}${voffset -23}[--datatype=WS --startday=1 --imperial]${font Arrows:size=36}${goto 110}[--datatype=BF --startday=2]${font Liberation Sans:size=8}${voffset -23}[--datatype=WS --startday=2 --imperial]${font Arrows:size=36}${goto 200}[--datatype=BF --startday=3]${font Liberation Sans:size=8}${voffset -23}[--datatype=WS --startday=3 --imperial]${font Arrows:size=36}${goto 290}[--datatype=BF --startday=4]${font Liberation Sans:size=8}${voffset -23}[--datatype=WS --startday=4 --imperial]${font}${color}
${color6}${voffset -13}${font ConkyWeather:size=36}${goto 21}[--datatype=WF --startday=1]${goto 111}[--datatype=WF --startday=2]${goto 201}[--datatype=WF --startday=3]${goto 291}[--datatype=WF --startday=4]${font}${color}
${voffset -45}${font ConkyWeather:size=36}${goto 20}[--datatype=WF --startday=1]${goto 110}[--datatype=WF --startday=2]${goto 200}[--datatype=WF --startday=3]${goto 290}[--datatype=WF --startday=4]${font}


By Bruce

Conkyforecast-bruce.png

As you will see, ONE ${execpi} call gets ALL the weather information. Very easy on resources.

The lines in my conky that calls for this display:

TEXT
${execpi 7200 ~/Conky/scripts/invisible_weather.sh}
${voffset -35}${execpi 1800 conkyForecast --location=ARDF0127 --template=/home/bruloo/Conky/scripts/myweather.template}

and myweather.template. As you see it’s in Spanish, easy to change:

${goto 10}${color8}${font ConkyWeather:size=55}[--datatype=WF]$font$color
    ${voffset -70}${goto 90}${color2}${font Zekton:size=20}[--datatype=DW --shortweekday --startday=0]:${color6} [--datatype=HT]
    ${goto 90}${voffset -10}${font Zekton:bold:size=9}${color2}Sensación térmica: ${color6}[--datatype=LT]$font
    ${goto 90}${color2}Mín: ${color6}[--startday=0 --datatype=LT] ${color2}Máx: ${color9}[--startday=0 --datatype=HT]
    ${goto 10}${voffset 10}${font Zekton:bold:size=11} ${color7}[--datatype=CC]$color$font
    ${goto 300}${voffset -110}${font ConkyWindN:size=40}${color8}[--datatype=BS]$font
    ${goto 380}${voffset -45}${color7}Viento: ${color8}[--datatype=WS] ${color7}(${color8}[--datatype=WA]°${color7}) ${color8}[--datatype=WD]
    ${voffset 0}${goto 380}${color7}Visibilidad:${color8} [--datatype=VI]
    ${voffset 0}${goto 380}${color7}P. de R.: ${color8}[--datatype=DP]$color
    ${goto 300}${voffset 10}${color7}Presión: ${color8}[--datatype=BR] - [--datatype=BD]$color
    ${goto 300}${color7}Humedad: ${color8}[--datatype=HM]  ${color7}UV: ${color8}[--datatype=UI] - ${color8}[--datatype=UT]
    ${goto 300}${cpubar cpu3 1,300}
    ${goto 15}${voffset 20}${color8}${font SunNMoon:size=50}n$font${goto 70}${voffset -38}${font Arrows:size 20}${color3}b${color8}${font}[--datatype=SR]
    ${goto 75}${color0}Luz: [--datatype=DL]
    ${goto 70}${font Arrows:size 20}${color1}h${color8}${font}[--datatype=SS]$color
    ${goto 170}${voffset -50}${font moon phases:size=40}[--datatype=MF]$font
    ${voffset -70}${goto 300}${color2}[--datatype=DW --shortweekday --startday=1]:${color1}[--datatype=HT --hideunits --hidedegreesymbol --startday=1]${color}/${color7}[--datatype=LT --hideunits --hidedegreesymbol --startday=1]${goto 380}${color2}[--datatype=DW --shortweekday --startday=2]:${color1}[--datatype=HT --hideunits --hidedegreesymbol --startday=2]${color}/${color7}[--datatype=LT --hideunits --hidedegreesymbol --startday=2]${goto 460}${color2}[--datatype=DW --shortweekday --startday=3]:${color1}[--datatype=HT --hideunits --hidedegreesymbol --startday=3]${color}/${color7}[--datatype=LT --hideunits --hidedegreesymbol --startday=3]${goto 540}${color2}[--datatype=DW --shortweekday --startday=4]:${color1}[--datatype=HT --hideunits --hidedegreesymbol --startday=4]${color}/${color7}[--datatype=LT --hideunits --hidedegreesymbol --startday=4]
    ${goto 300}${color8}${font ConkyWeather:size=30}[--datatype=WF --startday=1]${goto 380}[--datatype=WF --startday=2]${goto 460}[--datatype=WF --startday=3]${goto 540}[--datatype=WF --startday=4]$font$color
    ${goto 300}${color7}Sol:${color3}[--datatype=SR --startday=1]${goto 380}${color7}Sol:${color3}[--datatype=SR --startday=2]${goto 460}${color7}Sol:${color3}[--datatype=SR --startday=3]${goto 540}${color7}Sol:${color3}[--datatype=SR --startday=4]
    ${goto 300}${color7}   :${color1}[--datatype=SS --startday=1]${goto 380}${color7}   :${color1}[--datatype=SS --startday=2]${goto 460}${color7}   :${color1}[--datatype=SS --startday=3]${goto 540}${color7}   :${color1}[--datatype=SS --startday=4]$color
    ${goto 15}${font DejaVu Sans Mono:bold:size=7}W:[--datatype=LU] -=- C:[--datatype=LF]$font${voffset -2}${goto 300}${color7}Luz:${color8}[--datatype=DL --startday=1]${goto 380}${color7}Luz:${color8}[--datatype=DL --startday=2]${goto 460}${color7}Luz:${color8}[--datatype=DL --startday=3]${goto 540}${color7}Luz:${color8}[--datatype=DL --startday=4]$color

Templates need no calls from conky, although Crinos512 add some in a neat way.

7 Day Forecast (1)

xeddog, discovered this one, thanks xeddox!

Weather.com allows us to use conkyForecast with a 4 day forecast, something changed and with the change we can get a 7 day forecast.

The changes necessary are:

Don’t forget: Make a backup!

No guarantees that this is permanent, weather.com is famous for making changes all the time, so make that backup!

Terminal: (replace gedit with your favourite text editor)

gksudo gedit /usr/share/conkyforecast/conkyForecast.py

And in that file:

Line # Info

Change:

# 625 MAX_DAY_NUMBER = 4

to:

# 625 MAX_DAY_NUMBER = 7

and xoap to xml here:

# 783 url = “http://xml.weather.com/weather/local/”

And you ‘re done!

7 Day Forecast (2)

Conky v1.7.1 & conkyForecast v2.08 - with Images

By : Bruce

With the coming of Conky v1.7.1, a must for what follows, comes the new, among others, $image command:

imlib_cache_size
Imlib2 image cache size, in bytes. Defaults to 4MiB. Increase this value if you use $image lots. Set to 0 to disable the image cache.

Personally I set it to “0″

image
(-p x,y) (-s WxH) (-n) (-f interval)

Renders an image from the path specified using Imlib2. 
Takes 4 optional arguments: a position, a size, a no-cache switch, and a cache flush interval.
Changing the x,y position will move the position of the image, and changing the WxH will scale the image. 
If you specify the no-cache flag (-n), the image will not be cached. 
Alternately, you can specify the -f int switch to specify a cache flush interval for a particular image.
Example: ${image /home/brenden/cheeseburger.jpg -p 20,20 -s 200×200} will render ‘cheeseburger.jpg’ at (20,20) scaled to 200×200 pixels.
Conky does not make any attempt to adjust the position (or any other formatting) of images, they are just rendered as per the arguments passed.
The only reason $image is part of the TEXT section, is to allow for runtime modifications, through $execp $lua_parse, or some other method.

And with these changes Conky is really growing up - teenager. Conky becomes an adult with Lua :D

One of the best uses I’ve made of the $image command is with Kaivalagi’s Python Script for weather: conkyForecast. Grabbing the images from his other app: gtk-desktop-info (not conky) and combining them with conkyForecast was the work of stepper his first little HowTo can be seen here, which of course no longer applies as Kaivalagi has updated conkyForecast to include the images.

EDIT: So why show stuff that no longer applies, two reasons, one is historical and the second is if someone read the links they may just get an idea for something new.

So today, conkyForecast (as of version: 2.08) can use the “font” type command to display:

[--datatype=WF] – weather conditions,
[--datatype=MF] – moon phases, and
[--datatype=BF] – wind bearing

or the $image command

${image [--datatype=WI] -p 12,0 -s 90×90} – weather conditions,
${image [--datatype=MI] -p 12,0 -s 90×90} – moon phases, and
${image [--datatype=BI] -p 12,0 -s 90×90} – wind bearing

The -p and -s elements of course will need to be changed to meet your specific needs.

It is important to remember:

Conky does not make any attempt to adjust the position (or any other formatting) of images, they are just rendered as per the arguments passed.

So the image commands can literally go anywhere under TEXT, I’ve experimented and added a few image commands directly after the first command under text on the same line so that they don’t add a line to conky.

For example:

TEXT
${font DejaVu Sans Mono:bold:size=10}${color5}${exec less ~/Conky/bruloo.txt}$color${image xxxx}${image xxxx}${image xxxx}
${color6}${exec less ~/Conky/liloo.txt}$color$font
next line

So at this point you can have a weather forecast that looks like these, mine on the left, stepper’s on the right:

Conkyforecast-7day2-1.png

or the traditional “font” display:

Conkyforecast-7day2-2.png

The only difference is in the commands used as seen above.

Here is my conkyforecast

    background no
    own_window yes
    own_window_type override
    own_window_transparent yes
    own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
    own_window_colour black
    double_buffer yes
    use_spacer left
    override_utf8_locale yes
    use_xft yes
    font DejaVu Sans Mono:bold:size=9
    xftfont DejaVu Sans Mono:bold:size=9
    xftalpha 0.5
    update_interval 5.0
    uppercase no # set to yes if you want all text to be in uppercase
    stippled_borders 0 #3
    border_margin 0 #9
    border_width 0 #10
    default_outline_color black
    default_shade_color black
    draw_borders no
    draw_outline yes # amplifies text if yes
    draw_shades yes # shadecolor black
 
    default_color DCDCDC #Gainsboro
    color0 7FFFD4 #Aquamarine
    color1 CD5C5C #IndianRed #00CED1 DarkTurquoise #FFA07A LightSalmon #00FFFF Cyan
    color2 FF8C00 #Darkorange #D2691E #Chocolate
    color3 7FFF00 #Chartreuse
    color4 778899 #LightSlateGrey
    color5 FFDEAD #NavajoWhite
    color6 00BFFF #DeepSkyBlue
    # colours below used by colorize script
    color7 48D1CC #MediumTurquoise
    color8 FFFF00 #Yellow
    color9 FF0000 #Red
 
    alignment bl # Aligned position on screen: tl, tr, tm, bl, br, bm, ml, mr
    gap_x 5
    gap_y -25 # because of the VOFFSET, the negative "gap_y" value brings conky back to the bottom of the screen.
    text_buffer_size 6144 # 256 is the minimum
    no_buffers yes # Subtract file system buffers from used memory?
    short_units yes
    pad_percents 2
    imlib_cache_size 0
 
    TEXT
    ${execpi 7200 ~/Conky/scripts/invisible_weather.sh}
    ${voffset -50}${execpi 1800 conkyForecast --location=ARDF0127 --template=/home/bruloo/Conky/scripts/weather-7.template}

and my weather-7.template (using images)

    ${image [--datatype=WI] -p 12,0 -s 90x90}${goto 120}${color2}${font Zekton:size=20}[--datatype=DW --shortweekday --startday=0]:${color6} [--datatype=HT]
    ${goto 120}${voffset -10}${font Zekton:bold:size=9}${color2}Sensación térmica: ${color6}[--datatype=LT --night]${font}
    ${goto 120}${color2}Mín: ${color6}[--startday=0 --datatype=LT --night] ${color2}Máx: ${color9}[--startday=0 --datatype=HT --night]
    ${goto 10}${voffset 10}${font Zekton:bold:size=11} ${color7}[--datatype=CC]${color}${font}
    ${goto 10}${voffset 3}${color7}Visibilidad:${color8} [--datatype=VI]
    ${goto 10}${voffset 3}${color7}P. de R.: ${color8}[--datatype=DP]${color}
    ${goto 10}${voffset 3}${color7}Presión: ${color8}[--datatype=BR] - [--datatype=BD]${color}
    ${goto 10}${voffset 3}${color7}Humedad: ${color8}[--datatype=HM] ${color7}UV: ${color8}[--datatype=UI] - ${color8}[--datatype=UT]
    ${goto 15}${voffset 5}${color8}${font SunNMoon:size=50}n${font}${goto 70}${voffset -38}${font Arrows:size 20}${color3}b${color8}${font}[--datatype=SR]
    ${goto 75}${color0}Luz: [--datatype=DL]
    ${goto 70}${font Arrows:size 20}${color1}h${color8}${font}[--datatype=SS]${color}
    ${image [--datatype=MI] -p 173,180 -s 55x55}
    ${goto 15}${font DejaVu Sans Mono:bold:size=7}W:[--datatype=LU] -=- C:[--datatype=LF]${font}
    ${image [--datatype=BI] -p 280,6 -s 80x80}
    ${goto 280}${voffset -195}${color7}(${color8}[--datatype=WA]°${color7}) ${color8}[--datatype=WD]
    ${goto 300}${voffset 5}${color8}[--datatype=WS]
    ${voffset -110}${goto 380}${color2}[--datatype=DW --shortweekday --startday=1]:${color1}[--datatype=HT --hideunits --hidedegreesymbol --startday=1]${color}/${color7}[--datatype=LT --hideunits --hidedegreesymbol --startday=1]${goto 480}${color2}[--datatype=DW --shortweekday --startday=2]:${color1}[--datatype=HT --hideunits --hidedegreesymbol --startday=2]${color}/${color7}[--datatype=LT --hideunits --hidedegreesymbol --startday=2]${goto 580}${color2}[--datatype=DW --shortweekday --startday=3]:${color1}[--datatype=HT --hideunits --hidedegreesymbol --startday=3]${color}/${color7}[--datatype=LT --hideunits --hidedegreesymbol --startday=3]
    ${image [--datatype=WI --startday=1] -p 380,20 -s 50x50}${image [--datatype=WI --startday=2] -p 480,20 -s 50x50}${image [--datatype=WI --startday=3] -p 580,20 -s 50x50}
    ${voffset 30}${goto 380}${color7}Sol:${color3}[--datatype=SR --startday=1]${goto 480}${color7}Sol:${color3}[--datatype=SR --startday=2]${goto 580}${color7}Sol:${color3}[--datatype=SR --startday=3]
    ${goto 380}${color7} :${color1}[--datatype=SS --startday=1]${color}${goto 480}${color7} :${color1}[--datatype=SS --startday=2]${color}${goto 580}${color7} :${color1}[--datatype=SS --startday=3]${color}
    ${goto 380}${color7}Luz:${color8}[--datatype=DL --startday=1]${color}${goto 480}${color7}Luz:${color8}[--datatype=DL --startday=2]${color}${goto 580}${color7}Luz:${color8}[--datatype=DL --startday=3]${color}
    ${voffset 10}${color8}${goto 280}${cpubar cpu3 1,370}${color}
    ${voffset 10}${goto 280}${color2}[--datatype=DW --shortweekday --startday=4]:${color1}[--datatype=HT --hideunits --hidedegreesymbol --startday=4]${color}/${color7}[--datatype=LT --hideunits --hidedegreesymbol --startday=4]${goto 380}${color2}[--datatype=DW --shortweekday --startday=5]:${color1}[--datatype=HT --hideunits --hidedegreesymbol --startday=5]${color}/${color7}[--datatype=LT --hideunits --hidedegreesymbol --startday=5]${goto 480}${color2}[--datatype=DW --shortweekday --startday=6]:${color1}[--datatype=HT --hideunits --hidedegreesymbol --startday=6]${color}/${color7}[--datatype=LT --hideunits --hidedegreesymbol --startday=6]${goto 580}${color2}[--datatype=DW --shortweekday --startday=7]:${color1}[--datatype=HT --hideunits --hidedegreesymbol --startday=7]${color}/${color7}[--datatype=LT --hideunits --hidedegreesymbol --startday=7]
    ${image [--datatype=WI --startday=4] -p 280,160 -s 50x50}${image [--datatype=WI --startday=5] -p 380,160 -s 50x50}${image [--datatype=WI --startday=6] -p 480,160 -s 50x50}${image [--datatype=WI --startday=7] -p 580,160 -s 50x50}
    ${voffset 35}${goto 280}${color7}Sol:${color3}[--datatype=SR --startday=4]${goto 380}${color7}Sol:${color3}[--datatype=SR --startday=5]${goto 480}${color7}Sol:${color3}[--datatype=SR --startday=6]${goto 580}${color7}Sol:${color3}[--datatype=SR --startday=7]
    ${goto 280}${color7} :${color1}[--datatype=SS --startday=4]${color}${goto 380}${color7} :${color1}[--datatype=SS --startday=5]${color}${goto 480}${color7} :${color1}[--datatype=SS --startday=6]${color}${goto 580}${color7} :${color1}[--datatype=SS --startday=7]${color}
    ${goto 280}${color7}Luz:${color8}[--datatype=DL --startday=4]${color}${goto 380}${color7}Luz:${color8}[--datatype=DL --startday=5]${color}${goto 480}${color7}Luz:${color8}[--datatype=DL --startday=6]${color}${goto 580}${color7}Luz:${color8}[--datatype=DL --startday=7]${color}

Or if you prefer : steppers template

    ${image [--datatype=WI] -p 12,0 -s 90x90}${image [--datatype=MI] -p 12,80 -s 50x50}
    ${voffset 55}${goto 25}${color3}[--datatype=HT --hideunits --centeredwidth=3]/[--datatype=LT --hideunits --centeredwidth=3]
    ${voffset -70}${goto 120}${color1}${font Bitstream Vera Sans Mono:style=Bold:size=11}[--datatype=CT]${font}
    ${voffset 10}${goto 120}${color2}Station: ${color1}Buenos Aires, Arg
    ${goto 120}${color2}Rain: ${color1}[--datatype=PC]
    ${goto 120}${color2}UV: ${color1}[--datatype=UI] - [--datatype=UT]
    ${goto 120}${color2}Humidity: ${color1}[--datatype=HM]
    ${goto 120}${color2}Dew Point: ${color1}[--datatype=DP]
    ${goto 120}${color2}Sunrise/Set: ${color1}[--datatype=SR] / [--datatype=SS]
    ${goto 120}${color2}Bar: ${color1}[--datatype=BR] - [--datatype=BD]
    ${goto 120}${color2}Moon: ${color1}[--datatype=MP]
    ${color2}${font Bitstream Vera Sans Mono:size=7}${goto 120}Last Update: [--datatype=LU]${font}
    ${voffset 5}${goto 32}[--datatype=DW --startday=1 --shortweekday]${goto 80}[--datatype=DW --startday=2 --shortweekday]${goto 124}[--datatype=DW --startday=3 --shortweekday]${goto 172}[--datatype=DW --startday=4 --shortweekday]${goto 220}[--datatype=DW --startday=5 --shortweekday]${goto 268}[--datatype=DW --startday=6 --shortweekday]${goto 316}[--datatype=DW --startday=7 --shortweekday]
    ${image [--datatype=WI --startday=1] -p 12,160 -s 40x40}${image [--datatype=WI --startday=2] -p 60,160 -s 40x40}${image [--datatype=WI --startday=3] -p 108,160 -s 40x40}${image [--datatype=WI --startday=4] -p 156,160 -s 40x40}${image [--datatype=WI --startday=5] -p 204,160 -s 40x40}${image [--datatype=WI --startday=6] -p 252,160 -s 40x40}${image [--datatype=WI --startday=7] -p 300,160 -s 40x40}
    ${voffset 24}${goto 27}${color3}[--datatype=HT --startday=1 --hideunits --centeredwidth=3]/[--datatype=LT --startday=1 --hideunits --centeredwidth=3]${goto 75}[--datatype=HT --startday=2 --hideunits --centeredwidth=3]/[--datatype=LT --startday=2 --hideunits --centeredwidth=3]${goto 119}[--datatype=HT --startday=3 --hideunits --centeredwidth=3]/[--datatype=LT --startday=3 --hideunits --centeredwidth=3]${goto 167}[--datatype=HT --startday=4 --hideunits --centeredwidth=3]/[--datatype=LT --startday=4 --hideunits --centeredwidth=3]${goto 215}[--datatype=HT --startday=5 --hideunits --centeredwidth=3]/[--datatype=LT --startday=5 --hideunits --centeredwidth=3]${goto 263}[--datatype=HT --startday=6 --hideunits --centeredwidth=3]/[--datatype=LT --startday=6 --hideunits --centeredwidth=3]${goto 311}[--datatype=HT --startday=7 --hideunits --centeredwidth=3]/[--datatype=LT --startday=7 --hideunits --centeredwidth=3]

Hope you find this useful.

Personal tools
Namespaces
Variants
Actions
Navigation
English
Français
Toolbox