with Images

Conky v1.7.1 & conkyForecast v2.08

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.

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 bee seen here, which of course no longer applies as Kaivalagi has updated conkyForecast to include the images.

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:

mine-stepper

or the traditional “font” display:

7_for_7

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.

Comments are closed.