You are not logged in.

#1321 2016-10-26 20:10:11

mihaicociuba
New Member
Registered: 2016-10-26
Posts: 4

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

@Teo- I'm using your scripts for a long time and I must say thanks for all your great work .
I've seen this command on commandlinefu : curl wttr.in/Seville. Which uses worldweatheronline.com.go to obtain the weather information. And was wondering if we could use their api in conky?

Last edited by mihaicociuba (2016-10-26 20:11:14)

Offline

#1322 2016-10-26 20:21:39

TeoBigusGeekus
BL DieHard
From: /Deutschland/Frankfurt_am_Main
Registered: 2015-10-04
Posts: 1,486

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

mihaicociuba wrote:

@Teo- I'm using your scripts for a long time and I must say thanks for all your great work .
I've seen this command on commandlinefu : curl wttr.in/Seville. Which uses worldweatheronline.com.go to obtain the weather information. And was wondering if we could use their api in conky?

Do you mean wttr.in or worldweatheronline?


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#1323 2016-10-26 20:56:46

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,011

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

^I've bee using wettr.in in Openbox for a thile and as a bash script to get different cities.

In Openbox the Command is:

terminator --geometry=1010x720+20+20 -b -x wttr

and the bash script in ~/bin/wttr

#!/bin/bash
###
### https://en.wikipedia.org/wiki/List_of_airports_by_IATA_code:_A
###

### ?m = metric  ?u = imperial Without either: both


weather() {
     if [ ! -z $1 ]
     then
         curl -4 http://wttr.in/$1
     else
         curl -4 http://wttr.in
     fi

	}
weather $1
$SHELL

with no "input" it gets your local weather:

directly clicking on the link in OB:
Bv0XQf0A.jpg
and in the terminal adding a city: wttr kastoria
9cRJfa2f.jpg

I've never thought about in a conky.  INTERESTING!


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#1324 2016-10-26 21:08:31

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,011

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

And here it is - Conky v1.9 - 1_accuweather (2016) and 4_moon as per my previos post on this subject but this one uses the 2016 weather icons.

Colour coded to match the images and a few things moved around to make it fit/look better.
gg6UJuaC.jpg
Same warning and Note as before:

WARNING:  Be careful of the directories, the scripts are on different partitions.
ALSO NOTE:

#TEXT --- Remove line below TEXT when developing new conky
# These lines not required see: S12_time_tm.conky
#${execi 900 bash $HOME/1_accuweather/1_accuweather -f2015 -f2016 -h2015 -h2016}\
#${execi 900 bash /media/5/Conky/4_Moon/moon}\

... above the TEXT line

Note the temp of 8° for Thu 27 Oct and how it's touching the image.
The spacing has been set for 3 characters.

OK with °C 100° is not going to happen (hopefully) but it will with °F and both °C and °F can get -12° or more (three characters).

EDIT: Forgot the conky.  DUH!  Here is is for the 2016 images.

# pkill -xf "conky -q -c $HOME/1_accuweather/Clock-9day-Moon-2.conky" &
# Created: Wed 26 Oct 2016 14:21:13
## ---------- Begin Window Settings

own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints skip_taskbar,skip_pager,undecorated,below #,sticky
own_window_colour 000000
own_window_class Conky
own_window_title A Clock - Weather & Moon
# ARGB can be used for real transparency
#  own_window_argb_visual yes ## Options: yes or no
# Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
#  own_window_argb_value 70

minimum_size 200 1000
maximum_width 200

gap_x 10	## l|r
gap_y 10	## u|d
alignment tl
## ---------- End Window Settings
## ---------- Font Settings
## Use Xft (anti-aliased font and stuff)
use_xft yes
xftfont Fantasque Sans Mono:bold:size=11

## Alpha of Xft font. Must be a value at or between 1 and 0
xftalpha 1.0

## Force UTF8? requires XFT
override_utf8_locale yes

## --------- End Font Settings
## --------- Color Settings
draw_shades yes
default_shade_color 000000
draw_outline no
default_outline_color 000000

default_color b6bbbf ## 2016 grey & Digital clock lighted
color1 ff9838 ## 2016 orange
color2 00aebd ## 2016 green-blue
color3 696969 ## Digital clock unlighted
color4 48D1CC ## MediumTurquoise
color5 FFDEAD ## NavajoWhite
color6 00BFFF ## DeepSkyBlue
color7 B0E0E6 ## PowderBlue
color8 778899 ## LightSlateGray
color9 CD5C5C ## IndianRed
## ---------- End Color Settings
## ---------- Begin Borders Section
draw_borders no
## Stippled borders?
stippled_borders 5
## border margins
border_inner_margin 5
border_outer_margin 0
## border width
border_width 2
## graph borders
draw_graph_borders yes ## no
## default_graph_size 15 40
## ---------- End Borders Secton
## ---------- Begin Miscellaneous Section
## Boolean value, if true, Conky will be forked to background when started.
background yes ## yes
imlib_cache_size 0

## Adds spaces around certain objects to stop them from moving other things
## around, this only helps if you are using a mono font
## Options: right, left or none
use_spacer none

## Subtract (file slystem) buffers from used memory?
no_buffers yes

## Use the Xdbe extension? (eliminates flicker)
## It is highly reco${color}mmended to use own window with this one
## so double buffer won't be so big.
double_buffer yes

update_interval 1
#TEXT --- Remove line below TEXT when developing new conky
# These lines not required see: S12_time_tm.conky
#${execi 900 bash $HOME/1_accuweather/1_accuweather -f2015 -f2016 -h2015 -h2016}\
#${execi 900 bash /media/5/Conky/4_Moon/moon}\

TEXT
${image /media/5/Conky/images/bk_40.png -p -5,-5 -s 220x1000}\
${image /media/5/Conky/4_Moon/0.png -p 17,138 -s 60x60}\
${image $HOME/1_accuweather/forecast_2016/forecast_0.png -p 35,135 -s 140x140}\
${alignc}${color1}${swapbar 0,15} Today's Sun Data ${swapbar 0,15}${color}
Rise${color2} ${execpi 600 sed -n '14p' $HOME/1_accuweather/curr_cond}\
${alignr}${color}Set ${color2}${execpi 600 sed -n '15p' $HOME/1_accuweather/curr_cond}${color}
${alignc}Duration: ${color2}${execi 300 sed -n '16p' $HOME/1_accuweather/curr_cond}
${font LED_mono:size=30}${goto 30}${color 696969}88:88:88${goto 30}${color}${time %T}${color}${font}
${font Fantasque Sans Mono:bold:size=16}${color1}${alignc}${time %a %d %b %Y}${color}${font}
${alignc}${color2}${if_match ${time %H}<12}Good Morning${else}\
${if_match ${time %H}<18}Good Afternoon${else}Good Evening${endif}${endif}${color}
${font monofur:bold:size=16}${color1}±${execpi 600 sed -n '3p' $HOME/1_accuweather/curr_cond}°\
${alignr}${color}${execpi 600 sed -n '2p' $HOME/1_accuweather/curr_cond}°${font}









Bar ${color2}${execpi 600 sed -n '8p' $HOME/1_accuweather/curr_cond}${color}\
${goto 150}Cld${alignr}${color2}${execi 90 sed -n '10p' $HOME/1_accuweather/curr_cond}${color}
UVI ${color2}${execpi 600 sed -n '9p' $HOME/1_accuweather/curr_cond} /11${color}\
${goto 150}Hum${alignr}${color2}${execpi 600 sed -n '7p' $HOME/1_accuweather/curr_cond}${color}
 DP ${color2}${execi 90 sed -n '12p' $HOME/1_accuweather/curr_cond}°${color}\
${alignr}Vis ${color2}${execi 90 sed -n '13p' $HOME/1_accuweather/curr_cond}${color}
${alignc}Wind ${color2}${execi 90 sed -n '5p' $HOME/1_accuweather/curr_cond}\
 ${color}@ ${color2}${execi 90 sed -n '6p' $HOME/1_accuweather/curr_cond}${color}
${alignc}${color1}${swapbar 0,15} TEN DAY FORECAST ${swapbar 0,15}${color}
  ${pre_exec echo `date --date="0 day" | awk '{print $1" "$3" "$2}'`}\
${alignr 10}${pre_exec echo `date --date="1 day" | awk '{print $1" "$3" "$2}'`}
${image $HOME/1_accuweather/forecast_2016/forecast_1.png -p 22,365 -s 48x48}\
${image $HOME/1_accuweather/forecast_2016/forecast_2.png -p 129,365 -s 48x48}\
${goto 11}${color1}${execi 90 sed -n '3p' $HOME/1_accuweather/first_days}°\
  ${goto 118}${execi 90 sed -n '8p' $HOME/1_accuweather/first_days}°${color}

${goto 66}${color2}${execi 90 sed -n '4p' $HOME/1_accuweather/first_days}°\
  ${goto 174}${execi 90 sed -n '9p' $HOME/1_accuweather/first_days}°${color}
  ${pre_exec echo `date --date="2 day" | awk '{print $1" "$3" "$2}'`}\
${alignr 10}${pre_exec echo `date --date="3 day" | awk '{print $1" "$3" "$2}'`}
${image $HOME/1_accuweather/forecast_2016/forecast_3.png -p 22,425 -s 48x48}\
${image $HOME/1_accuweather/forecast_2016/forecast_4.png -p 129,425 -s 48x48}\
${goto 11}${color1}${execi 90 sed -n '13p' $HOME/1_accuweather/first_days}°\
  ${goto 118}${execi 90 sed -n '18p' $HOME/1_accuweather/first_days}°${color}

${goto 66}${color2}${execi 90 sed -n '14p' $HOME/1_accuweather/first_days}°\
  ${goto 174}${execi 90 sed -n '19p' $HOME/1_accuweather/first_days}°${color}
  ${pre_exec echo `date --date="4 day" | awk '{print $1" "$3" "$2}'`}\
${alignr 10}${pre_exec echo `date --date="5 day" | awk '{print $1" "$3" "$2}'`}
${image $HOME/1_accuweather/forecast_2016/forecast_5.png -p 22,485 -s 48x48}\
${image $HOME/1_accuweather/forecast_2016/forecast_6.png -p 129,485 -s 48x48}\
${goto 11}${color1}${execi 90 sed -n '23p' $HOME/1_accuweather/first_days}°\
  ${goto 118}${execi 90 sed -n '3p' $HOME/1_accuweather/last_days}°${color}

${goto 66}${color2}${execi 90 sed -n '24p' $HOME/1_accuweather/first_days}°\
  ${goto 174}${execi 90 sed -n '4p' $HOME/1_accuweather/last_days}°${color}
  ${pre_exec echo `date --date="6 day" | awk '{print $1" "$3" "$2}'`}\
${alignr 10}${pre_exec echo `date --date="7 day" | awk '{print $1" "$3" "$2}'`}
${image $HOME/1_accuweather/forecast_2016/forecast_7.png -p 22,545 -s 48x48}\
${image $HOME/1_accuweather/forecast_2016/forecast_8.png -p 129,545 -s 48x48}\
${goto 11}${color1}${execi 90 sed -n '8p' $HOME/1_accuweather/last_days}°\
  ${goto 118}${execi 90 sed -n '13p' $HOME/1_accuweather/last_days}°${color}

${goto 66}${color2}${execi 90 sed -n '9p' $HOME/1_accuweather/last_days}°\
  ${goto 174}${execi 90 sed -n '14p' $HOME/1_accuweather/last_days}°${color}
  ${pre_exec echo `date --date="8 day" | awk '{print $1" "$3" "$2}'`}\
${alignr 10}${pre_exec echo `date --date="9 day" | awk '{print $1" "$3" "$2}'`}
${image $HOME/1_accuweather/forecast_2016/forecast_9.png -p 22,605 -s 48x48}\
${image $HOME/1_accuweather/forecast_2016/forecast_10.png -p 129,605 -s 48x48}\
${goto 11}${color1}${execi 90 sed -n '18p' $HOME/1_accuweather/last_days}°\
  ${goto 118}${execi 90 sed -n '23p' $HOME/1_accuweather/last_days}°${color}

${goto 66}${color2}${execi 90 sed -n '19p' $HOME/1_accuweather/last_days}°\
  ${goto 174}${execi 90 sed -n '24p' $HOME/1_accuweather/last_days}°${color}
${swapbar 0}
${alignc}${color1}${swapbar 0,15} The Southern Moon ${swapbar 0,15}${color}
${goto 5}${execi 3600 echo `date --date="-2 day" | awk '{print $1" "$3" "$2}'`}\
${alignr}${execi 3600 echo `date --date="-1 day" | awk '{print $1" "$3" "$2}'`}\
${image /media/5/Conky/4_Moon/-2.png -p 18,697 -s 45x45}
${image /media/5/Conky/4_Moon/-1.png -p 150,697 -s 45x45}
${image /media/5/Conky/4_Moon/0.png -p 295,635 -s 90x90}
${image /media/5/Conky/4_Moon/1.png -p 18,937 -s 45x45}
${image /media/5/Conky/4_Moon/2.png -p 150,937 -s 45x45}
${alignc}${color1}${swapbar 0,15} Today's Moon Data ${swapbar 0,15}${color}
${alignc}${color2}${execpi 600 sed -n '7p' /media/5/Conky/4_Moon/raw}${color}
Rise${color2} ${execpi 600 sed -n '18p' $HOME/1_accuweather/curr_cond}${color}\
${alignr}${color}Set ${color2}${execpi 600 sed -n '19p' $HOME/1_accuweather/curr_cond}${color}
    Duration: ${color2}${execi 300 sed -n '20p' $HOME/1_accuweather/curr_cond}${color}
Illumination: ${color2}${execpi 600 sed -n '1p' /media/5/Conky/4_Moon/raw}${color}
   Sun Angle: ${color2}${execpi 600 sed -n '2p' /media/5/Conky/4_Moon/raw}°${color}
    Sun Dist: ${color2}${execpi 600 sed -n '3p' /media/5/Conky/4_Moon/raw}${color}
   Moon Dist: ${color2}${execpi 600 sed -n '4p' /media/5/Conky/4_Moon/raw}${color}
    Moon Age: ${color2}${execpi 600 sed -n '5p' /media/5/Conky/4_Moon/raw} days${color}
  Moon Angle: ${color2}${execpi 600 sed -n '6p' /media/5/Conky/4_Moon/raw}°${color}
${alignc}${color1}${swapbar 0,150}${color}
${goto 5}${execi 3600 echo `date --date="1 day" | awk '{print $1" "$3" "$2}'`}\
${alignr}${execi 3600 echo `date --date="2 day" | awk '{print $1" "$3" "$2}'`}

Have fun!

Last edited by Sector11 (2016-10-27 17:22:57)


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#1325 2016-10-27 00:16:30

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,011

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

This little ten day "forecast" conky is in test mode....
ae9wyyA0.jpg

Currently it wants to show "10" & "Lo" for the temperatures for "Tonight".  With conky's ${if_match...} statements I'm forcing it to show nothing where the "10" would be and a "low temp" of "10" where the "Lo" would be.  Will know better tomorrow if this works and at that time I will post the code.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#1326 2016-10-27 15:13:31

TeoBigusGeekus
BL DieHard
From: /Deutschland/Frankfurt_am_Main
Registered: 2015-10-04
Posts: 1,486

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Nice ones as well. I really like the new accuweather icons.


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#1327 2016-10-27 17:28:52

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,011

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

TeoBigusGeekus wrote:

Nice ones as well. I really like the new accuweather icons.

Well the ${if_match ...} has an OOPSIE!
Qe0jMHMj.jpg
Considering today's forecast is 17° and 8° ... back to the drawing board!

DAMN 8° tonight - VERY unseasonable!!!


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#1328 2016-10-27 17:31:41

TeoBigusGeekus
BL DieHard
From: /Deutschland/Frankfurt_am_Main
Registered: 2015-10-04
Posts: 1,486

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Is the 10/Lo thing such a big deal?
I could do something about it in the script during the weekend.
I didn't mind it so much so I left it in the original one.


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#1329 2016-10-27 17:44:43

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,011

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Noooooooooo  ... it's just that I'm picky.

During the day I show

17
   (image)
           8

and at night the script changes and those values become:

8
   (image)
           Lo

Since I colour code the highs with a red(ish) colour and the lows with a blue colour the 8 at night - which indicates the low in is the high location, and coloured for high, and Lo shows up as blue.

It's just an OOPS! in my coding  smile

Will have it fixed in a few minutes.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#1330 2016-10-27 18:16:01

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,011

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

OK, I think I have it - only need to wait until the 'change' tonight:
ILjwlXTt.jpg

Those 2016 images are growing on me - not as 'bright' as the 2015 set.  smile

I added an extra shaded background to help see then with lighter walls; sample:

${image /media/5/Conky/images/bk_40.png -p 20,0 -s 55x55}\
${image $HOME/1_accuweather/forecast_2016/forecast_1.png -p 20,0 -s 55x55}\
${image /media/5/Conky/images/bk_40.png -p 143,0 -s 55x55}\
${image $HOME/1_accuweather/forecast_2016/forecast_2.png -p 143,0 -s 55x55}\
${image /media/5/Conky/images/bk_40.png -p 260,0 -s 55x55}\

This bar is active on my Desktop 1 and replaces the 'font' version I was using.  I think it's a keeper.  smile


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#1331 2016-10-28 15:59:45

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,011

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Woke up this morning and the "High" was there but not the "Low"  ???
6BeKdse0.jpg
The dog is my wife's idea for the day.  smile

Put the two lines in my test conky and ran it, without updating the database - and there they were, AND it updated the conky in question ... not sure what the heck is going on, but if anyone else wants to test here the code:

# pkill -xf "conky -q -c /home/sector11/1_accuweather/S11_accu_tm_BAR_2016.conky" &
# works - Fri 16 Sep 2016
###  Begin Window Settings  ########################################
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,skip_taskbar,skip_pager
own_window_colour 000000
own_window_class Conky
own_window_title Accu tm BAR
#own_window_argb_visual yes
#own_window_argb_value 80 # 0 - clear | 255 - solid

minimum_size 1110 75 ##75	##	w|h
maximum_width 1110

gap_x 0 ## l|r
gap_y 2 ## u|d

alignment tm
##########################################  End Window Settings  ###
###  Font Settings  ################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
xftfont Fantasque Sans Mono:bold:size=14

# Alpha of Xft font. Must be a value at or between 1 and 0 ###
xftalpha 1.0

# Force UTF8? requires XFT ###
override_utf8_locale yes

uppercase no
############################################  End Font Settings  ###
###  Color Settings  ###############################################
draw_shades yes
default_shade_color 000000
draw_outline no
default_outline_color 000000

default_color FAEBD7 #AntiqueWhite ## DCDCDC #Gainsboro
color0 A9A9A9 #DarkGrey
color1 778899 #LightSlateGray
color2 FAEBD7 #AntiqueWhite
color3 87CEFA #LightSkyBlue
color4 48D1CC #MediumTurquoise
color5 FFDEAD #NavajoWhite
color6 00BFFF #DeepSkyBlue
color7 F8F8FF #GhostWhite
color8 FFD700 #Gold
color9 FFA07A #LightSalmon
###########################################  End Color Settings  ###
###  Borders Section  ##############################################
draw_borders no #yes
# Stippled borders?
stippled_borders 5
# border margins
border_inner_margin 0
border_outer_margin 0
# border width
border_width 2
# graph borders
draw_graph_borders yes #no
#default_graph_size 15 40
###########################################  End Borders Secton  ###
###  Miscellaneous Section  ########################################
# Boolean value, if true, Conky will be forked to background when started.
background yes

# Adds spaces around certain objects to stop them from moving other things
# around, this only helps if you are using a mono font
# Options: right, left or none
use_spacer none

# Subtract (file slystem) buffers from used memory?
no_buffers yes

# Use the Xdbe extension? (eliminates flicker)
# It is highly recommended to use own window with this one
# so double buffer won't be so big.
double_buffer yes
#####################################  End Miscellaneous Section  ###

#TEXT --- Remove line below TEXT when developing new conky
# This line not required see S12_time_tm.conky
#${execi 900 bash /home/sector11/1_accuweather/1_accuweather -f -h}\

update_interval 1
TEXT
${image /media/5/Conky/images/bk_40.png -p -5,-5 -s 1125x90}\
${color9}${if_match "${execpi 300 sed -n '4p' /home/sector11/1_accuweather/first_days}" == "Lo"} \
${else}${execpi 300 sed -n '3p' /home/sector11/1_accuweather/first_days}${endif}\
	${goto 123}${execpi 300 sed -n '8p' /home/sector11/1_accuweather/first_days}\
	${goto 240}${execpi 300 sed -n '13p' /home/sector11/1_accuweather/first_days}\
	${goto 355}${execpi 300 sed -n '18p' /home/sector11/1_accuweather/first_days}\
	${goto 475}${execpi 300 sed -n '23p' /home/sector11/1_accuweather/first_days}\
	${goto 590}${execpi 300 sed -n '3p' /home/sector11/1_accuweather/last_days}\
	${goto 703}${execpi 300 sed -n '8p' /home/sector11/1_accuweather/last_days}\
	${goto 810}${execpi 300 sed -n '13p' /home/sector11/1_accuweather/last_days}\
	${goto 918}${execpi 300 sed -n '18p' /home/sector11/1_accuweather/last_days}\
	${goto 1026}${execpi 300 sed -n '23p' /home/sector11/1_accuweather/last_days}

${color3}${goto 70}${if_match "${execpi 300 sed -n '4p' /home/sector11/1_accuweather/first_days}" == "Lo"}\
${execpi 300 sed -n '3p' /home/sector11/1_accuweather/first_days}\
${else}${execpi 300 sed -n '4p' /home/sector11/1_accuweather/first_days}${endif}
	${goto 193}${execpi 300 sed -n '9p' /home/sector11/1_accuweather/first_days}\
	${goto 310}${execpi 300 sed -n '14p' /home/sector11/1_accuweather/first_days}\
	${goto 425}${execpi 300 sed -n '19p' /home/sector11/1_accuweather/first_days}\
	${goto 545}${execpi 300 sed -n '24p' /home/sector11/1_accuweather/first_days}\
	${goto 660}${execpi 300 sed -n '4p' /home/sector11/1_accuweather/last_days}\
	${goto 770}${execpi 300 sed -n '9p' /home/sector11/1_accuweather/last_days}\
	${goto 878}${execpi 300 sed -n '14p' /home/sector11/1_accuweather/last_days}\
	${goto 985}${execpi 300 sed -n '19p' /home/sector11/1_accuweather/last_days}\
	${goto 1092}${execpi 300 sed -n '24p' /home/sector11/1_accuweather/last_days}\
${image /media/5/Conky/4_Moon/0.png -p 75,2 -s 30x30}\
${image /media/5/Conky/images/bk_40.png -p 20,0 -s 55x55}\
${image $HOME/1_accuweather/forecast_2016/forecast_1.png -p 20,0 -s 55x55}\
${image /media/5/Conky/images/bk_40.png -p 143,0 -s 55x55}\
${image $HOME/1_accuweather/forecast_2016/forecast_2.png -p 143,0 -s 55x55}\
${image /media/5/Conky/images/bk_40.png -p 260,0 -s 55x55}\
${image $HOME/1_accuweather/forecast_2016/forecast_3.png -p 260,0 -s 55x55}\
${image /media/5/Conky/images/bk_40.png -p 375,0 -s 55x55}\
${image $HOME/1_accuweather/forecast_2016/forecast_4.png -p 375,0 -s 55x55}\
${image /media/5/Conky/images/bk_40.png -p 495,0 -s 55x55}\
${image $HOME/1_accuweather/forecast_2016/forecast_5.png -p 495,0 -s 55x55}\
${image /media/5/Conky/images/bk_40.png -p 610,0 -s 55x55}\
${image $HOME/1_accuweather/forecast_2016/forecast_6.png -p 610,0 -s 55x55}\
${image /media/5/Conky/images/bk_40.png -p 722,0 -s 55x55}\
${image $HOME/1_accuweather/forecast_2016/forecast_7.png -p 722,0 -s 55x55}\
${image /media/5/Conky/images/bk_40.png -p 830,0 -s 55x55}\
${image $HOME/1_accuweather/forecast_2016/forecast_8.png -p 830,0 -s 55x55}\
${image /media/5/Conky/images/bk_40.png -p 938,0 -s 55x55}\
${image $HOME/1_accuweather/forecast_2016/forecast_9.png -p 938,0 -s 55x55}\
${image /media/5/Conky/images/bk_40.png -p 1045,0 -s 55x55}\
${image $HOME/1_accuweather/forecast_2016/forecast_10.png -p 1045,0 -s 55x55}
${color5}${execi 3600 echo `date --date="0 day" | awk '{print $1" "$3" "$2}'`}   \
${execi 3600 echo `date --date="1 day" | awk '{print $1" "$3" "$2}'`}   \
${execi 3600 echo `date --date="2 day" | awk '{print $1" "$3" "$2}'`}   \
${execi 3600 echo `date --date="3 day" | awk '{print $1" "$3" "$2}'`}   \
${execi 3600 echo `date --date="4 day" | awk '{print $1" "$3" "$2}'`}   \
${execi 3600 echo `date --date="5 day" | awk '{print $1" "$3" "$2}'`}   \
${execi 3600 echo `date --date="6 day" | awk '{print $1" "$3" "$2}'`}   \
${execi 3600 echo `date --date="7 day" | awk '{print $1" "$3" "$2}'`}   \
${execi 3600 echo `date --date="8 day" | awk '{print $1" "$3" "$2}'`}   \
${execi 3600 echo `date --date="9 day" | awk '{print $1" "$3" "$2}'`}

OH yea, I added the moon from 4_moon as well,

${image /media/5/Conky/4_Moon/0.png -p 75,2 -s 30x30}\

Strip that out if you don't want it.  CHECK the /paths/to/elements as well.  big_smile

Edited to fix the error unklar points out below.  Thank you unklar!

Last edited by Sector11 (2016-10-28 23:06:12)


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#1332 2016-10-28 21:08:07

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,648

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

^ The distances should be corrected. With the reduction of the font I have already played.
However, the terminal gives this error:

...
Conky: one or more $endif's are missing
...

tm_BAR.th.jpg
With "Lo" (Low), I do not understand you.  8)


Edit:
Line 103/104
Is too much   O:)

Last edited by unklar (2016-10-28 21:30:29)

Offline

#1333 2016-10-28 23:03:13

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,011

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

unklar wrote:

Edit:
Line 103/104
Is too much   O:)

OH OH  Now that is a major OOPS! on my part.  I'm embarrassed! Thank you!!!

How many times I've told people for every ${if_match} you need an ${endif} and while they added up right there was an extra line in there. roll  :8  :8   I'm getting too old for this.  big_smile

The code has been updated in my post above.

RE:  "Lo"
In the morning take a look at ~/1_accuweather/first_days the first 5 lines will look something like this:

1 TODAY
2 33
3 17
4 12
5 Clear

line 3 is today's forecasted high temp and line 4 is today's low temp.

Sometime after 18:00 it will look like this:

1 TONIGHT
2 33
3 12
4 Lo
5 Clear

Today's low temp is moved to line 3 and the letters "Lo" are on line 4.  smile

Accuweather stops 'broadcasting' a forecasted high for a day that has all but ended.

The ${if_match ...} commands are check to see if 'Lo' is on line 4. wink


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#1334 2016-10-29 14:29:39

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,648

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Sector11 wrote:

RE:  "Lo"
In the morning ...

Excuse me for my blindness. Not just you're getting older   sad

This is now my adapted version on 1680x1050 in KDE.
What does not work is the display of bk_40.png images. That is why I have the corners
rounded.  wink

# pkill -xf "conky -q -c /home/unklar/1_accuweather/S11_accu_tm_BAR_2016.conky" &
# works - Fri 16 Sep 2016
###  Begin Window Settings  ########################################
own_window yes
own_window_type normal
own_window_transparent yes 
own_window_hints undecorated,below,skip_taskbar,skip_pager
#own_window_colour 000000
own_window_class Conky
own_window_title Accu tm BAR
own_window_argb_visual yes
own_window_argb_value 240       #0 - clear | 255 - solid

minimum_size 1110 75 ##75	##	w|h
#maximum_width 1110

gap_x 10 ## l|r
gap_y 15 ## u|d

alignment tl
##########################################  End Window Settings  ###
###  Font Settings  ################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
xftfont Fantasque Sans Mono:bold:size=13

# Alpha of Xft font. Must be a value at or between 1 and 0 ###
xftalpha 1.0

# Force UTF8? requires XFT ###
override_utf8_locale yes

uppercase no
############################################  End Font Settings  ###
###  Color Settings  ###############################################
draw_shades yes
default_shade_color 000000
draw_outline no
default_outline_color 000000

default_color FAEBD7 #AntiqueWhite ## DCDCDC #Gainsboro
color0 A9A9A9 #DarkGrey
color1 778899 #LightSlateGray
color2 FAEBD7 #AntiqueWhite
color3 87CEFA #LightSkyBlue
color4 48D1CC #MediumTurquoise
color5 FFDEAD #NavajoWhite
color6 00BFFF #DeepSkyBlue
color7 F8F8FF #GhostWhite
color8 FFD700 #Gold
color9 FFA07A #LightSalmon
###########################################  End Color Settings  ###
###  Borders Section  ##############################################
draw_borders no #yes
# Stippled borders?
stippled_borders 5
# border margins
border_inner_margin 0
border_outer_margin 0
# border width
border_width 2
# graph borders
draw_graph_borders yes #no
#default_graph_size 15 40
###########################################  End Borders Secton  ###
###  Miscellaneous Section  ########################################
# Boolean value, if true, Conky will be forked to background when started.
background yes

# Adds spaces around certain objects to stop them from moving other things
# around, this only helps if you are using a mono font
# Options: right, left or none
use_spacer none

# Subtract (file slystem) buffers from used memory?
no_buffers yes

# Use the Xdbe extension? (eliminates flicker)
# It is highly recommended to use own window with this one
# so double buffer won't be so big.
double_buffer yes
#####################################  End Miscellaneous Section  ###

update_interval 1

#--LUA--#
lua_load ~/LUA/draw-bg.lua

TEXT
${lua conky_draw_bg 10 0 0 0 0 0x000000 0.2}\
${execi 900 bash /home/unklar/1_accuweather/1_accuweather -f -h}\
${image $HOME/1_pixel_images/bk_70.png -p -5,-5 -s 1125x90}\
${color9}${if_match "${execpi 300 sed -n '4p' /home/unklar/1_accuweather/first_days}" == "Lo"}\
${else}${execpi 300 sed -n '3p' /home/unklar/1_accuweather/first_days}${endif}\
	${goto 123}${execpi 300 sed -n '8p' /home/unklar/1_accuweather/first_days}\
	${goto 240}${execpi 300 sed -n '13p' /home/unklar/1_accuweather/first_days}\
	${goto 355}${execpi 300 sed -n '18p' /home/unklar/1_accuweather/first_days}\
	${goto 475}${execpi 300 sed -n '23p' /home/unklar/1_accuweather/first_days}\
	${goto 590}${execpi 300 sed -n '3p' /home/unklar/1_accuweather/last_days}\
	${goto 703}${execpi 300 sed -n '8p' /home/unklar/1_accuweather/last_days}\
	${goto 810}${execpi 300 sed -n '13p' /home/unklar/1_accuweather/last_days}\
	${goto 918}${execpi 300 sed -n '18p' /home/unklar/1_accuweather/last_days}\
	${goto 1026}${execpi 300 sed -n '23p' /home/unklar/1_accuweather/last_days}

${color3}${goto 70}${if_match "${execpi 300 sed -n '4p' /home/unklar/1_accuweather/first_days}" == "Lo"}\
${execpi 300 sed -n '3p' /home/unklar/1_accuweather/first_days}\
	${else}${execpi 300 sed -n '4p' /home/unklar/1_accuweather/first_days}${endif}\
	${goto 193}${execpi 300 sed -n '9p' /home/unklar/1_accuweather/first_days}\
	${goto 310}${execpi 300 sed -n '14p' /home/unklar/1_accuweather/first_days}\
	${goto 425}${execpi 300 sed -n '19p' /home/unklar/1_accuweather/first_days}\
	${goto 545}${execpi 300 sed -n '24p' /home/unklar/1_accuweather/first_days}\
	${goto 660}${execpi 300 sed -n '4p' /home/unklar/1_accuweather/last_days}\
	${goto 770}${execpi 300 sed -n '9p' /home/unklar/1_accuweather/last_days}\
	${goto 878}${execpi 300 sed -n '14p' /home/unklar/1_accuweather/last_days}\
	${goto 985}${execpi 300 sed -n '19p' /home/unklar/1_accuweather/last_days}\
	${goto 1092}${execpi 300 sed -n '24p' /home/unklar/1_accuweather/last_days}\
${image $HOME/4_Moon/0.png -p 75,2 -s 30x30}\
${image /home/unklar/1_pixel_images/bk_70.png -p 20,0 -s 50x50}\
${image $HOME/1_accuweather/forecast_2016/forecast_1.png -p 20,0 -s 50x50}\
${image /home/unklar/1_pixel_images/bk_70.png -p 143,0 -s 50x50}\
${image $HOME/1_accuweather/forecast_2016/forecast_2.png -p 143,0 -s 50x50}\
${image $HOME/1_pixel_images/bk_70.png -p 260,0 -s 50x50}\
${image $HOME/1_accuweather/forecast_2016/forecast_3.png -p 260,0 -s 50x50}\
${image $HOME/1_pixel_images/bk_70.png -p 375,0 -s 50x50}\
${image $HOME/1_accuweather/forecast_2016/forecast_4.png -p 375,0 -s 50x50}\
${image $HOME/1_pixel_images/bk_70.png -p 495,0 -s 50x50}\
${image $HOME/1_accuweather/forecast_2016/forecast_5.png -p 495,0 -s 50x50}\
${image $HOME/1_pixel_images/bk_70.png -p 610,0 -s 50x50}\
${image $HOME/1_accuweather/forecast_2016/forecast_6.png -p 610,0 -s 50x50}\
${image $HOME/1_pixel_images/bk_70.png -p 722,0 -s 50x50}\
${image $HOME/1_accuweather/forecast_2016/forecast_7.png -p 722,0 -s 50x50}\
${image $HOME/1_pixel_images/bk_70.png -p 830,0 -s 50x50}\
${image $HOME/1_accuweather/forecast_2016/forecast_8.png -p 830,0 -s 50x50}\
${image $HOME/1_pixel_images/bk_70.png -p 938,0 -s 50x50}\
${image $HOME/1_accuweather/forecast_2016/forecast_9.png -p 938,0 -s 50x50}\
${image $HOME/1_pixel_images/bk_70.png -p 1045,0 -s 50x50}\
${image $HOME/1_accuweather/forecast_2016/forecast_10.png -p 1045,0 -s 50x50}
 ${color5}${execi 3600 echo `date --date="0 day" | awk '{print $1" "$2""$3}'`}   \
  ${execi 3600 echo `date --date="1 day" | awk '{print $1" "$2""$3}'`}   \
 ${execi 3600 echo `date --date="2 day" | awk '{print $1" "$2""$3}'`}   \
 ${execi 3600 echo `date --date="3 day" | awk '{print $1" "$2""$3}'`}   \
  ${execi 3600 echo `date --date="4 day" | awk '{print $1" "$2""$3}'`}   \
  ${execi 3600 echo `date --date="5 day" | awk '{print $1" "$2""$3}'`}   \
  ${execi 3600 echo `date --date="6 day" | awk '{print $1" "$2""$3}'`}   \
 ${execi 3600 echo `date --date="7 day" | awk '{print $1" "$2""$3}'`}   \
${execi 3600 echo `date --date="8 day" | awk '{print $1" "$2""$3}'`}   \
 ${execi 3600 echo `date --date="9 day" | awk '{print $1" "$2""$3}'`} 

tm_BAR1.th.jpg
Unfortunately the effort for a "normal user" is enormous.  hmm

Offline

#1335 2016-10-29 15:21:12

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,011

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

Well, yes, you are right, getting old is something we all do, and it's great to have friend help us do it.

Your rounded corners are because you are using them with the "draw-bg.lua" background:

#--LUA--#
lua_load ~/LUA/draw-bg.lua

TEXT
${lua conky_draw_bg 10 0 0 0 0 0x000000 0.2}\
${execi 900 bash /home/unklar/1_accuweather/1_accuweather -f -h}\
${image $HOME/1_pixel_images/bk_70.png -p -5,-5 -s 1125x90}\
${color9}${if_match "${execpi 300 sed -n '4p' /home/unklar/1_accuweather/first_days}" == "Lo"}\

Here:
${lua conky_draw_bg 10 0 0 0 0 0x000000 0.2}\

The 10 is for the rounded corners, change the 10 to 0 to get square corners.  Also, the final 0.2 can be increased to make it darker;  ie: 0.4

If you continue to use the lua background you can delete this line:

${image $HOME/1_pixel_images/bk_70.png -p -5,-5 -s 1125x90}\

I don't know if you have my draw-bg.lua or another copy but I changed the beginning of mine to make the HowTo easier to read:

--[[Background originally by londonali1010 (2009)
    ability to set any size for background mrpeachy 2011
    ability to set variables for bg in conkyrc dk75

  the change is that if you set width and/or height to 0
  then it assumes the width and/or height of the conky window

so:

Above and After TEXT  (requires a composite manager or it blinks!)

 lua_load ~/path/to/draw-bg.lua
 TEXT
 ${lua conky_draw_bg 10 0 0 0 0 0x000000 0.2}

OR Both above TEXT (no composite manager required - no blinking!)

 lua_load ~/path/to/draw-bg.lua
 lua_draw_hook_pre draw_bg 10 0 0 0 0 0x000000 0.2
 TEXT

Note
${lua conky_draw_bg 20 0 0 0 0 0x000000 0.2}
  See below:        1  2 3 4 5 6        7

${lua conky_draw_bg corner_radius x_position y_position width height color alpha}

covers the whole window and will change if you change the minimum_size setting

1 = 20            corner_radius
2 = 0             x_position l|r
3 = 0             y_position u|d
4 = 0             width
5 = 0             height
6 = 0x000000      color
7 = 0.4           alpha

######### calendar function ##################################################

then to use it, you activate the calendar function BELOW TEXT like this

${lua luacal {settings}}

#${lua luacal {x=,y=,tf="",tfs=,tc=,ta=,bf="",bfs=,bc=,ba=,hf="",hfs=,hc=,ha=,sp="",gh=,gt=,gv=,sd=}}
#    x=x position top left
#    y=y position top left
#    tf=title font, eg "mono" must be in quotes
#    tfs=title font size
#    tc=title color
#    ta=title alpha
#    bf=body font, eg "mono" must be in quotes
#    bfs=body font size
#    bc=body color
#    ba=body alpha
#    hf=highlight font, eg "mono" must be in quotes
#    hfs=highlight font size
#    hc=highlight color
#    ha=highlight alpha
#    sp=spacer, eg " " or sp="0"... 0,1 or 2 spaces can help with positioning of non-monospaced fonts

##### GAPS #####
#    gt=gap from title to body
#    gh=gap horizontal between columns
#    gv=gap vertical between rows
#    sd=start day, 0=Sun, 1=Mon

#    hstyle = heading style, 0=just days, 1=date insert
#    tdf=title date font, eg "mono" must be in quotes
#    tdfs=title date font size
#    tdc=title date color
#    tda=title date alpha

# test line
-- ${lua luacal {x=20,y=100,tf="Monofur",tfs=24,tc=0xFFDEAD,ta=1,bf="Monofur",bfs=24,bc=0xFFDEAD,ba=1,hf="Monofur",hfs=24,hc=0x00BFFF,ha=1,sp="0",gh=60,gt=26,gv=20,sd=0,hstyle=1,tdf="Monofur",tdfs=24,tdc=0x00BFFF,tda=1}}


]]

require 'cairo'
local    cs, cr = nil
function rgb_to_r_g_b(colour,alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
function conky_draw_bg(r,x,y,w,h,color,alpha)
if conky_window == nil then return end
if cs == nil then cairo_surface_destroy(cs) end
if cr == nil then cairo_destroy(cr) end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
w=w
h=h
if w=="0" then w=tonumber(conky_window.width) end
if h=="0" then h=tonumber(conky_window.height) end
cairo_set_source_rgba (cr,rgb_to_r_g_b(color,alpha))
--top left mid circle
local xtl=x+r
local ytl=y+r
--top right mid circle
local xtr=(x+r)+((w)-(2*r))
local ytr=y+r
--bottom right mid circle
local xbr=(x+r)+((w)-(2*r))
local ybr=(y+r)+((h)-(2*r))
--bottom right mid circle
local xbl=(x+r)
local ybl=(y+r)+((h)-(2*r))
-----------------------------
cairo_move_to (cr,xtl,ytl-r)
cairo_line_to (cr,xtr,ytr-r)
cairo_arc(cr,xtr,ytr,r,((2*math.pi/4)*3),((2*math.pi/4)*4))
cairo_line_to (cr,xbr+r,ybr)
cairo_arc(cr,xbr,ybr,r,((2*math.pi/4)*4),((2*math.pi/4)*1))
cairo_line_to (cr,xbl,ybl+r)
cairo_arc(cr,xbl,ybl,r,((2*math.pi/4)*1),((2*math.pi/4)*2))
cairo_line_to (cr,xtl-r,ytl)
cairo_arc(cr,xtl,ytl,r,((2*math.pi/4)*2),((2*math.pi/4)*3))
cairo_close_path(cr)
cairo_fill (cr)
------------------------------------------------------------
cairo_surface_destroy(cs)
cairo_destroy(cr)
return ""
end
-- ###### calendar function ##################################################
function conky_luacal(caltab) -- {x=,y=,tf="",tfs=,tc=,ta=,bf="",bfs=,bc=,ba=,hf="",hfs=,hc=,ha=,sp="",gt=,gh=,gv=,sd=,hstyle=,tdf=,tdfs=,tdc=,tda=}
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
--############################################################################
if caltab.x==nil then
caltab=loadstring("return" .. caltab)()
end
local cal_x=caltab.x
local cal_y=caltab.y
local tfont=caltab.tf		or "mono"
local tfontsize=caltab.tfs	or 12
local tc=caltab.tc			or 0xffffff
local ta=caltab.ta			or 1
local bfont=caltab.bf		or "mono"
local bfontsize=caltab.bfs	or 12
local bc=caltab.bc			or 0xffffff
local ba=caltab.ba			or 1
local hfont=caltab.hf		or "mono"
local hfontsize=caltab.hfs	or 12
local hc=caltab.hc			or 0xff0000
local ha=caltab.ha			or 1
local spacer=caltab.sp		or " "
local gaph=caltab.gh		or 20
local gapt=caltab.gt		or 15
local gapl=caltab.gv		or 15
local sday=caltab.sd		or 0
local hstyle=caltab.hstyle	or 0
--convert colors
--local font=string.gsub(font,"_"," ")
local tred,tgreen,tblue,talpha=rgb_to_r_g_b(tc,ta)
--main body text color
local bred,bgreen,bblue,balpha=rgb_to_r_g_b(bc,ba)
--highlight text color
local hred,hgreen,hblue,halpha=rgb_to_r_g_b(hc,ha)
--############################################################################
--calendar calcs
local year=os.date("%G")
local today=tonumber(os.date("%d"))
local t1 = os.time( {    year=year,month=03,day=01,hour=00,min=0,sec=0} );
local t2 = os.time( {    year=year,month=02,day=01,hour=00,min=0,sec=0} );
local feb=(os.difftime(t1,t2))/(24*60*60)
local monthdays={ 31, feb, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
local day=tonumber(os.date("%w"))+1-sday
local day_num = today
local remainder=day_num % 7
local start_day=day-(day_num % 7)
if start_day<0 then start_day=7+start_day end
local month=os.date("%m")
local mdays=monthdays[tonumber(month)]
local x=mdays+start_day
local dnum={}
local dnumh={}
if mdays+start_day<36 then
dlen=35
plen=29
else
dlen=42
plen=36
end
for i=1,dlen do
    if i<=start_day then
    dnum[i]="  "
    else
    dn=i-start_day
        if dn=="nil" then dn=0 end
        if dn<=9 then dn=(spacer .. dn) end
        if i>x then dn="" end
        dnum[i]=dn
        dnumh[i]=dn
        if dn==(spacer .. today) or dn==today then
        dnum[i]=""
        end
        if dn==(spacer .. today) or dn==today then
        dnumh[i]=dn
        place=i
        else dnumh[i]="  "
        end
    end
end--for
cairo_select_font_face (cr, tfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, tfontsize);
cairo_set_source_rgba (cr,tred,tgreen,tblue,talpha)
local extents=cairo_text_extents_t:create()
tolua.takeownership(extents)
if hstyle==0 then
    if tonumber(sday)==0 then
    dys={"SU","MO","TU","WE","TH","FR","SA"}
    else
    dys={"MO","TU","WE","TH","FR","SA","SU"}
    end
    --draw calendar titles
elseif hstyle==1 then
    if tonumber(sday)==0 then
    dys={"SU","MO"," ","  ","  ","FR","SA"}
    cairo_text_extents(cr,"MO",extents)
    local s=extents.x_advance+gaph
    local f=gaph*5
    local tdfont=caltab.tdf        or "mono"
    local tdfontsize=caltab.tdfs    or 12
    local tdc=caltab.tdc        or 0xffffff
    local tda=caltab.tda        or 1
    cairo_select_font_face (cr, tdfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
    cairo_set_font_size (cr, tdfontsize);
    local tdred,tdgreen,tdblue,tdalpha=rgb_to_r_g_b(tdc,tda)
    cairo_set_source_rgba (cr,tdred,tdgreen,tdblue,tdalpha)
    local insert=os.date("%b %y")
    cairo_text_extents(cr,insert,extents)
    local w=extents.x_advance
    cairo_move_to (cr, cal_x+((s+f)/2)-(w/2), cal_y)
    cairo_show_text (cr,insert)
    cairo_stroke (cr)
    else
    dys={"MO","TU"," ","  ","  ","SA","SU"}
    cairo_text_extents(cr,"TU",extents)
    local s=extents.x_advance+gaph
    local f=gaph*5
    local tdfont=caltab.tdf        or "mono"
    local tdfontsize=caltab.tdfs    or 12
    local tdc=caltab.tdc        or 0xffffff
    local tda=caltab.tda        or 1
    cairo_select_font_face (cr, tdfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
    cairo_set_font_size (cr, tdfontsize);
    local tdred,tdgreen,tdblue,tdalpha=rgb_to_r_g_b(tdc,tda)
    cairo_set_source_rgba (cr,tdred,tdgreen,tdblue,tdalpha)
    local insert=os.date("%b %y")
    cairo_text_extents(cr,insert,extents)
    local w=extents.x_advance
    cairo_move_to (cr, cal_x+((s+f)/2)-(w/2), cal_y)
    cairo_show_text (cr,insert)
    cairo_stroke (cr)
    end
end
--draw calendar titles
for i=1,7 do
cairo_select_font_face (cr, tfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, tfontsize);
cairo_set_source_rgba (cr,tred,tgreen,tblue,talpha)
cairo_move_to (cr, cal_x+(gaph*(i-1)), cal_y)
cairo_show_text (cr, dys[i])
cairo_stroke (cr)
end
--draw calendar body
cairo_select_font_face (cr, bfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, bfontsize);
cairo_set_source_rgba (cr,bred,bgreen,bblue,balpha)
for i=1,plen,7 do
local fn=i
    for i=fn,fn+6 do
    cairo_move_to (cr, cal_x+(gaph*(i-fn)),cal_y+gapt+(gapl*((fn-1)/7)))
    cairo_show_text (cr, dnum[i])
    cairo_stroke (cr)
    end
end
--highlight
cairo_select_font_face (cr, hfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, hfontsize);
cairo_set_source_rgba (cr,hred,hgreen,hblue,halpha)
for i=1,plen,7 do
local fn=i
    for i=fn,fn+6 do
    cairo_move_to (cr, cal_x+(gaph*(i-fn)),cal_y+gapt+(gapl*((fn-1)/7)))
    cairo_show_text (cr, dnumh[i])
    cairo_stroke (cr)
    end
end
--############################################################################
caltab=nil
dlen=nil
plen=nil
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end
-- end main function #########################################################

You can also use that line under TEXT more than once.  This is not one of Teo's scripts (v9000 lua script by mrpeachy) but it can be adapted in the same manner to any of Teo's scripts.  Foe example the 1_accuweather script we are talking about.  big_smile
o8ERjpqK.jpg

# -- Lua load -- #
lua_load ~/v9000/v9000.lua
lua_draw_hook_pre weather
lua_load /media/5/Conky/LUA/template_meteo_barre.lua
lua_load /media/5/Conky/LUA/draw-bg.lua
##############################################
update_interval 1

TEXT
${lua conky_draw_bg 10 0 0 480 87 0x000000 0.3}\
${lua conky_draw_bg 30 105 5 60 60 0xffffff 0.5}\
${lua conky_draw_bg 10 522 0 75 87 0x000000 0.3}\
${lua conky_draw_bg 10 640 0 75 87 0x000000 0.3}\
${lua conky_draw_bg 10 760 0 75 87 0x000000 0.3}\
${lua conky_draw_bg 10 880 0 75 87 0x000000 0.3}\
${lua conky_draw_bg 10 1000 0 75 87 0x000000 0.3}\
${lua conky_draw_bg 10 1120 0 75 87 0x000000 0.3}\
${lua conky_draw_bg 10 1240 0 75 87 0x000000 0.3}\
${lua conky_draw_bg 10 1360 0 75 87 0x000000 0.3}\
${lua conky_draw_bg 10 1480 0 75 87 0x000000 0.3}

This line:

${lua conky_draw_bg 30 105 5 60 60 0xffffff 0.5}\

does the white circle where the moon is  smile

Actually my friend we must change the way we think:

We're like a good bottle of wine, we get better with age!

NOTE:  I'm leaving shortly to go to my wife's uncle's country house.  Back tomorrow - I think I'll convert Teo's code I have to use the draw-bg.lua script as just discussed when I get back Sunday evening.  Well, Monday  smile


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#1336 2016-10-29 15:23:08

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,011

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

unklar wrote:

Unfortunately the effort for a "normal user" is enormous.  hmm

Ya, but for large monitors and people that need large font to see, it's nice!


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#1337 2016-10-31 19:57:48

TeoBigusGeekus
BL DieHard
From: /Deutschland/Frankfurt_am_Main
Registered: 2015-10-04
Posts: 1,486

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

mihaicociuba wrote:

@Teo- I'm using your scripts for a long time and I must say thanks for all your great work .
I've seen this command on commandlinefu : curl wttr.in/Seville. Which uses worldweatheronline.com.go to obtain the weather information. And was wondering if we could use their api in conky?

Best that could be done:

conky.config = {
-- Create own window instead of using desktop (required in nautilus)
	own_window = true,
	own_window_type = 'override',
	own_window_transparent = true,
	own_window_hints = 'undecorated,below,skip_taskbar,skip_pager',

-- Use double buffering (reduces flicker, may not work for everyone)
	double_buffer = true,

-- fiddle with window
	use_spacer = 'yes',
	use_xft = true,

-- Update interval in seconds
	update_interval = 3,

-- Minimum size of text area
	minimum_width = 300, minimum_height = 500,
	maximum_width = 1000,

	override_utf8_locale = true,

-- Draw shades?
	draw_shades = true,

-- Text stuff
	draw_outline = true,-- amplifies text if yes
	draw_borders = false,
--font freesans -12
	font = 'Fira Mono:size=10',
	uppercase = false,-- set to yes if you want all text to be in uppercase

-- Stippled borders?
	stippled_borders = 3,

-- border margins
	border_margin = '9',

-- border width
	border_width = 10,

-- Default colors and also border colors, grey90 == #e5e5e5
	default_color = '#E2EDDA',

	own_window_colour = 'brown',
	own_window_transparent = true,

-- Text alignment, other possible values are commented
--alignment top_left
	alignment = 'top_right',
--alignment bottom_left
--alignment bottom_right

-- Gap between borders of screen and text
	gap_x = 10,
	gap_y = 20,

	imlib_cache_size = 0,
	text_buffer_size = 1024,
-- stuff after 'TEXT' will be formatted on screen

};

conky.text = [[
${texeci 500 curl wttr.in/kastoria | sed '3,37!d' | perl -pe 's/\e\[?.*?[\@-~]//g' > weather}
${exec cat weather}
]];

I'm using the Fira Mono font cause it's the only Mono font that has all the wind directions.

dSYrL9Xt.png


Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!
Please make Autocad Civil 3D and Archicad work on Linux!

Offline

#1338 2016-10-31 22:22:15

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,011

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

OK, I have to ask.  Why do the arrows show in a terminal with  all mono fonts I plug in but not in conky?

What really really simple thing am I missing?


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#1339 2016-10-31 22:53:37

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,648

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

wttrConky.th.jpg

conky_V1.9

#https://forums.bunsenlabs.org/viewtopic.php?pid=39599#p39599
# Create own window instead of using desktop (required in nautilus)
	background yes
	own_window yes
	own_window_type normal
	own_window_transparent yes
	own_window_class Conky
#own_window_colour 000000
        own_window_argb_visual yes
        own_window_argb_value 240
	own_window_hints undecorated,below,skip_taskbar,skip_pager

# Use double buffering (reduces flicker, may not work for everyone)
	double_buffer yes

# fiddle with window
	use_spacer right
	use_xft yes

# Update interval in seconds
	update_interval 3

# Minimum size of text area
	minimum_size 840 525   # w|h
#maximum_width 1000

	override_utf8_locale yes

# Draw shades?
	draw_shades yes

# Text stuff
	draw_outline yes
	draw_borders no
#font freesans -12
	font Fira Mono:bold:size=10
	uppercase no

# Stippled borders?
	stippled_borders 3

# border margins
	border_inner_margin 9

# border width
	border_width = 10,

# Default colors and also border colors, grey90 == #e5e5e5
	default_color E2EDDA

#own_window_colour brown
#own_window_transparent yes

# Text alignment, other possible values are commented
#alignment top_left
#alignment top_right
#alignment bottom_left
#alignment bottom_right
	alignment middle_middle

# Gap between borders of screen and text
	gap_x 20
	gap_y 0

	imlib_cache_size 0
	text_buffer_size 1024
# stuff after 'TEXT' will be formatted on screen



TEXT
${texeci 500 curl wttr.in/lichtenstein | sed '3,37!d' | perl -pe 's/\e\[?.*?[\@-~]//g' > weather}
${exec cat weather}

 

@Teo,
how do I know that he takes the right lichtenstein (from three in GE)?  cool

Offline

#1340 2016-11-01 14:01:02

mihaicociuba
New Member
Registered: 2016-10-26
Posts: 4

Re: Conky weather+moon scripts (Accuw/WUndergr/NWS/MoonGiant)

@Teo - I don't think that the end results looks great, your scripts look way much better.
The command line weather uses the api from https://www.worldweatheronline.com/ , and their git (for CLI weather) is here https://github.com/chubin/wttr.in, so my logic was if you can use some of their work in order to have a conkyweather similar to the python script https://ubuntuforums.org/showthread.php?t=869328
This is just an idea so feel free to disregard it if it's not feasible.
In the meantime your scripts are working great.

Last edited by mihaicociuba (2016-11-01 14:01:32)

Offline

Board footer

Powered by FluxBB