You are not logged in.
beautiful Loutch
Nothing happens by chance
Offline
»»»»» This is for conky v1.90 «««««
The ConkyFV80chronograph Weather Station teamwork with Sector11 ( Yoda )
1b1)Accuweather - Images - 1b1_29-10-15- All users
1c)Accuweather Hourly Forecast - 1c_14-3-16
4) Moon phases' script - 4_2-6-15
Required for this layout:
conky font: monofur
Weather_Clock.lua
Weather_Clock.lua fonts: monofur, Liquid Crystal, CorporateMonoExtraBold
Nice to have:
draw-bg.lua
WARNING: Check the "paths" these are in:
/home/fvirgola80/1b1_accuweather_images/
/home/fvirgola80/4_Moon/
/home/fvirgola80/1c_accuweather_images_hourly/
Weather_Clock.lua
lang="Greek", -- English French Greek Spanish
hour=24, -- 12 | 24 - there is an oops! for Feb -57 days? in 12 hour mode - I need to check it.
- - - that will take a while .. I know very little about LUA
ConkyFV80chronograph.conky
# pkill -xf "conky -c /home/fvirgola80/clockconky/T-wunClock.conky" &
# conky -c /home/fvirgola80/clockconky/ConkyFV80chronograph.conky &
# Thank you:
# Chronograph LUA - Sector11 - tweaked with the help of mrpeachy
##### - See LUA for more (originally 4 clocks by mrpeachy)
# mounted.lua - londonali1010, mrpeachy, dk75
### Begin Window Settings ##################################################
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints skip_taskbar,skip_pager,undecorated,below ## skip_taskbar,skip_pager
own_window_colour 000000
own_window_class Conky
own_window_title FV80 Clock Digital
# 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
### ARGB can be used for real transparency
### NOTE that a composite manager is required for real transparency.
### This option will not work as desired (in most cases) in conjunction with
### own_window_type normal
# own_window_argb_visual yes
### When ARGB visuals are enabled, this use this to modify the alpha value
### Use: own_window_type normal
### Use: own_window_transparent no
### Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
# own_window_argb_value 0
#minimum_size 420 420 ## width, height
#maximum_width 420 ## width
### For use with The-Clock.lua
minimum_size 300 770 ## width, height
maximum_width 300 ## width
gap_x 10 #15 ### left &right
gap_y 10 ### up & down
### alignment values or top_left, bottom_right, etc
# tl, tm, tr
# ml, mm, mr
# bl, bm, br
alignment tl
#################################################### End Window Settings ###
### Font Settings ##########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
#xftfont CorporateMonoExtraBold:size=9
xftfont monofur:bold:size=9
# X font when Xft is disabled, you can pick one with program xfontsel
#font 5x7
#font 6x10
#font 7x13
#font 8x13
#font 9x15
#font *mintsmild.se*
#font -*-*-*-*-*-*-34-*-*-*-*-*-*-*
# Alpha of Xft font. Must be a value at or between 1 and 0 ###
xftalpha 1
# Force UTF8? requires XFT ###
override_utf8_locale yes
uppercase no
###################################################### End Font Settings ###
### Color Settings #########################################################
### Color Settings #########################################################
draw_shades no ## <<<--- yes --- To see it easier on light screens.
default_shade_color 000000
draw_outline no #### <<<--- yes --- Amplifies text if yes OJO with changing fonts
default_outline_color 000000
default_color DCDCDC #220 220 220 Gainsboro
#default_color C0C0C0 #192 192 192 Silver
#default_color B0E0E6 #176 224 230 PowderBlue
#default_color D8BFD8 #216 191 216 Thistle
color0 8FBC8F #DarkSeaGreen
#color1 C0C0C0 # Silver
#color1 D3D3D3 #LightGrey
color1 778899 #LightSlateGray
color2 F5F5DC #Beige
color3 87CEFA #LightSkyBlue
#color3 87CEFA #E0FFFF #LightCyan
color4 48D1CC #MediumTurquoise
color5 FFDEAD #NavajoWhite
color6 00BFFF #DeepSkyBlue
color7 B0E0E6 #PowderBlue
#color7 5F9EA0 #CadetBlue
#color8 FFFFE0 #LightYellow
color8 FFD700 #Gold
#color8 F0E68C #Khaki
color9 FFA07A #LightSalmon
#color9 CD5C5C #IndianRed
#color9 FF0000 #Red
##################################################### End Color Settings ###
### Borders Section ########################################################
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
border_inner_margin 5
border_outer_margin 0
# border width
border_width 0
# 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
# Default and Minimum size is 256 - needs more for single commands that
# "call" a lot of text IE: bash scripts
text_buffer_size 256
# Subtract (file system) buffers from used memory?
no_buffers yes
# change GiB to G and MiB to M
short_units yes
# Like it says, ot pads the decimals on % values
# doesn't seem to work since v1.7.1
# pad_percents 2
# If enabled, values which are in bytes will be printed in human readable
# format (i.e., KiB, MiB, etc). If disabled, bytes is printed instead
# format_human_readable yes
# Shortens units to a single character (kiB->k, GiB->G, etc.). Default is off.
short_units yes
imlib_cache_size 0
# Maximum size of user text buffer, i.e. layout below TEXT line in config file
# (default is 16384 bytes)
# max_user_text 16384
# Desired output unit of all objects displaying a temperature. Parameters are
# either "fahrenheit" or "celsius". The default unit is degree Celsius.
# temperature_unit Fahrenheit
## default bar size
default_bar_size 200 20
############################################## End Miscellaneous Section ###
### LUA Settings ###########################################################
## draw-bg.lua - Above and After TEXT - requires a composite manager.
##
## lua_load /home/fvirgola80/.config/conky/LUA/draw-bg.lua
#TEXT
# ${lua conky_draw_bg 125 0 0 0 0 0x000000 0.2}
#
# ----------------------------------------------------------------------------
## OR Both above TEXT - No composite manager required.
#
#lua_load /home/fvirgola80//LUA/draw-bg.lua
#lua_draw_hook_pre draw_bg 20 0 0 0 0 0x000000 0.2
#
# TEXT
### Teo Weather Clock ########################################################
lua_load /home/fvirgola80/.config/conky/LUA/Weather_Clock.lua
lua_draw_hook_post main
############################## End LUA Settings ###
update_interval 1
## USE THIS TEST Image:
## ${image /home/fvirgola80/images/red+x.png -p
##TEXT
##${lua conky_draw_bg 10 0 0 0 0 0x000000 0.6}\
##${texeci 600 bash /home/fvirgola80/1b1}\
##${texeci 600 bash /home/fvirgola80/4_Moon/moon_MoonGiant}\
## ${lua conky_draw_bg 10 0 0 0 0 0x000000 0.2}\
TEXT
${execi 600 /home/fvirgola80/1b1_accuweather_images/1b1}\
${execi 600 /home/fvirgola80/4_Moon/moon_MoonGiant}\
${execi 600 /home/fvirgola80/1c_accuweather_images_hourly/1c}\
${image /home/fvirgola80/images/bk_30.png -p -2,-5 -s 307x765}\
${image $HOME/images/LightSlateGrey_1.png -p 150,430 -s 2x328}\
${font monofur:bold:size=10}${color9}↑:${execi 600 sed -n '26p' $HOME/1b1_accuweather_images/first_days}°${alignr 5}\
T:${execi 600 sed -n '29p' $HOME/1b1_accuweather_images/curr_cond}°${color}
${color6}↓:${execi 600 sed -n '31p' $HOME/1b1_accuweather_images/first_days}°${alignr 5}\
${color6}±:${execi 600 sed -n '30p' $HOME/1b1_accuweather_images/curr_cond}°${color}${font}
${image /home/fvirgola80/4_Moon/0.png -p 70,70 -s 170x170}\
${image /home/fvirgola80/1b1_accuweather_images/cc.png -p 100,120 -s 108x65}\
${color5}S.Rise${alignr 5}S.Set
${color7}${execi 600 sed -n '39p' /home/fvirgola80/1b1_accuweather_images/curr_cond}${alignr 5}${execi 90 sed -n '40p' /home/fvirgola80/1b1_accuweather_images/curr_cond}
${color5}Hum${alignr 5}D.P.${color}
${color7}${execi 600 sed -n '32p' /home/fvirgola80/1b1_accuweather_images/curr_cond}${alignr 5}${execi 90 sed -n '35p' /home/fvirgola80/1b1_accuweather_images/curr_cond}°${color}
${color5}Pressure${alignr 5}UV Index${color}
${color7}${execi 600 sed -n '33p' /home/fvirgola80/1b1_accuweather_images/curr_cond}${alignr 5}${execi 600 sed -n '34p' /home/fvirgola80/1b1_accuweather_images/curr_cond} /11${color}${font}
${font monofur:bold:size=11}${alignc}${execpi 600 sed -n '1p' $HOME/1b1_accuweather_images/messages}${font}
${color5}Wind ${color7}${execi 90 sed -n '31p' /home/fvirgola80/1b1_accuweather_images/curr_cond}${alignr 5}${color5}←→ ${color7}${execi 90 sed -n '38p' /home/fvirgola80/1b1_accuweather_images/curr_cond}${color}
${color5}Cld ${color7}${execi 90 sed -n '36p' /home/fvirgola80/1b1_accuweather_images/curr_cond}${alignr 5}${color5}Vis${color7} ${execi 90 sed -n '37p' /home/fvirgola80/1b1_accuweather_images/curr_cond}${color}
${alignc}${color5}The current moon phase is ${color7}${execi 600 sed -n '7p' /home/fvirgola80/4_Moon/raw}${color}
${color5}Distance ${color7}${execi 600 sed -n '4p' $HOME/4_Moon/raw | cut -c-3} K/km${alignr 5}${color5}Visible ${color7}${execi 600 sed -n '1p' /home/fvirgola80/4_Moon/raw}${color}
${color5}Moon Age ${color7}${execi 600 sed -n '5p' /home/fvirgola80/4_Moon/raw} days${alignr 5}${color5}Moon Angle ${color7}${execi 600 sed -n '6p' /home/fvirgola80/4_Moon/raw}°${color}
${color5}Moonrise ${color7}${execi 90 sed -n '41p' /home/fvirgola80/1b1_accuweather_images/curr_cond}${alignr 5}${color5}Moonset ${color7}${execi 90 sed -n '42p' /home/fvirgola80/1b1_accuweather_images/curr_cond}${color}
${goto 37}${execi 3600 echo `date --date="1 day" | awk '{print $1" "$3" "$2}'`}\
${goto 155}${execi 600 sed -n '2p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${goto 240}${execpi 600 sed -n '3p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${image /home/fvirgola80/1c_accuweather_images_hourly/20.png -p 160,440 -s 70x45}\
${image /home/fvirgola80/1c_accuweather_images_hourly/23.png -p 240,440 -s 70x45}\
${image /home/fvirgola80/1b1_accuweather_images/6.png -p 53,440 -s 70x45}
${goto 30}${color9}↑↑ ${execi 90 sed -n '8p' /home/fvirgola80/1b1_accuweather_images/first_days}°\
${goto 155}${execpi 600 sed -n '52p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${goto 240}${execpi 600 sed -n '53p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}${color}
${goto 30}${color7}↓↓ ${execi 90 sed -n '9p' /home/fvirgola80/1b1_accuweather_images/first_days}°\
${goto 155}±${execpi 600 sed -n '61p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${goto 240}±${execpi 600 sed -n '62p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}${color}
${execi 3600 echo `date --date="2 day" | awk '{print $1" "$3" "$2}'`}\
${goto 80}${execi 3600 echo `date --date="3 day" | awk '{print $1" "$3" "$2}'`}\
${goto 155}${execpi 600 sed -n '4p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${goto 240}${execpi 600 sed -n '5p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${image /home/fvirgola80/1b1_accuweather_images/11.png -p 10,505 -s 70x45}\
${image /home/fvirgola80/1b1_accuweather_images/16.png -p 90,505 -s 70x45}\
${image /home/fvirgola80/1c_accuweather_images_hourly/26.png -p 160,505 -s 70x45}\
${image /home/fvirgola80/1c_accuweather_images_hourly/29.png -p 240,505 -s 70x45}
${goto 0}${color9}↑↑${execi 90 sed -n '13p' /home/fvirgola80/1b1_accuweather_images/first_days}°\
${goto 80}↑↑${execi 90 sed -n '18p' /home/fvirgola80/1b1_accuweather_images/first_days}°\
${goto 155}${execpi 600 sed -n '57p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${goto 240}${execpi 600 sed -n '58p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}${color}
${goto 0}${color7}↓↓${execi 90 sed -n '14p' /home/fvirgola80/1b1_accuweather_images/first_days}°\
${goto 80}↓↓${execi 90 sed -n '19p' /home/fvirgola80/1b1_accuweather_images/first_days}°${color}\
${goto 155}±${execpi 600 sed -n '61p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${goto 240}±${execpi 600 sed -n '64p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}${color}
${execi 3600 echo `date --date="4 day" | awk '{print $1" "$3" "$2}'`}\
${goto 80}${execi 3600 echo `date --date="5 day" | awk '{print $1" "$3" "$2}'`}\
${goto 155}${execpi 600 sed -n '6p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${goto 240}${execpi 600 sed -n '7p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${image /home/fvirgola80/1b1_accuweather_images/21.png -p 10,570 -s 70x45}\
${image /home/fvirgola80/1b1_accuweather_images/last_2.png -p 90,570 -s 70x45}\
${image /home/fvirgola80/1c_accuweather_images_hourly/32.png -p 160,570 -s 70x45}\
${image /home/fvirgola80/1c_accuweather_images_hourly/35.png -p 240,570 -s 70x45}
${goto 0}${color9}↑↑${execi 90 sed -n '23p' /home/fvirgola80/1b1_accuweather_images/first_days}°\
${goto 80}↑↑${execi 90 sed -n '4p' /home/fvirgola80/1b1_accuweather_images/last_days}°\
${goto 155}${execpi 600 sed -n '56p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${goto 240}${execpi 600 sed -n '57p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}${color}
${goto 0}${color7}↓↓${execi 90 sed -n '24p' /home/fvirgola80/1b1_accuweather_images/first_days}°\
${goto 80}↓↓${execi 90 sed -n '5p' /home/fvirgola80/1b1_accuweather_images/last_days}°\
${goto 155}±${execpi 600 sed -n '65p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${goto 240}±${execpi 600 sed -n '66p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}${color}
${execi 3600 echo `date --date="6 day" | awk '{print $1" "$3" "$2}'`}\
${goto 80}${execi 3600 echo `date --date="7 day" | awk '{print $1" "$3" "$2}'`}\
${goto 155}${execi 600 sed -n '8p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${goto 240}${execi 600 sed -n '9p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${image /home/fvirgola80/1b1_accuweather_images/last_7.png -p 10,635 -s 70x45}\
${image /home/fvirgola80/1b1_accuweather_images/last_12.png -p 90,635 -s 70x45}\
${image /home/fvirgola80//1c_accuweather_images_hourly/38.png -p 160,635 -s 70x45}\
${image /home/fvirgola80//1c_accuweather_images_hourly/41.png -p 240,635 -s 70x45}
${goto 0}${color9}↑↑${execi 90 sed -n '9p' /home/fvirgola80/1b1_accuweather_images/last_days}°\
${goto 80}↑↑${execi 90 sed -n '14p' /home/fvirgola80/1b1_accuweather_images/last_days}°\
${goto 155}${execi 600 sed -n '58p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${goto 240}${execpi 600 sed -n '59p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}${color}
${goto 0}${color7}↓↓${execi 90 sed -n '10p' /home/fvirgola80/1b1_accuweather_images/last_days}°\
${goto 80}↓↓${execi 90 sed -n '15p' /home/fvirgola80/1b1_accuweather_images/last_days}°\
${goto 155}±${execpi 600 sed -n '67p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${goto 240}±${execpi 600 sed -n '68p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}${color}
${execi 3600 echo `date --date="8 day" | awk '{print $1" "$3" "$2}'`}\
${goto 80}${execi 3600 echo `date --date="9 day" | awk '{print $1" "$3" "$2}'`}\
${goto 155}${execpi 10 sed -n '2p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw2}\
${goto 240}${execpi 10 sed -n '3p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw2}\
${image /home/fvirgola80/1b1_accuweather_images/last_17.png -p 10,700 -s 70x45}\
${image /home/fvirgola80/1b1_accuweather_images/last_22.png -p 90,700 -s 70x45}\
${image /home/fvirgola80//1c_accuweather_images_hourly/120.png -p 160,700 -s 70x45}\
${image /home/fvirgola80//1c_accuweather_images_hourly/123.png -p 240,700 -s 70x45}
${goto 0}${color9}↑↑${execi 90 sed -n '19p' /home/fvirgola80/1b1_accuweather_images/last_days}°\
${goto 80}↑↑${execi 90 sed -n '24p' /home/fvirgola80/1b1_accuweather_images/last_days}\
${goto 155}${execpi 10 sed -n '52p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw2}\
${goto 240}${execpi 10 sed -n '53p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw2}${color}
${goto 0}${color7}↓↓${execi 90 sed -n '20p' /home/fvirgola80/1b1_accuweather_images/last_days}°\
${goto 80}↓↓${execi 90 sed -n '25p' /home/fvirgola80/1b1_accuweather_images/last_days}°\
${goto 155}±${execpi 10 sed -n '61p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw2}\
${goto 240}±${execpi 10 sed -n '61p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw2}${color}
${color1}${membar 0,142} ${membar 0,145}${color}
Weather_Clock.lua
--[[ multiple analogue clocks by mrpeachy - 18 Jun 2012
21 Jun 2012 - Chronograph modifications by FV80
22 Jun 2012 - again with mrpeachy's help day names, numbers and month names
12 Nov 2012 - memory leak plugged - mrpeachy
use in conkyrc
lua_load /path/Chronograph.lua
lua_draw_hook_pre main
TEXT
-- INDEX use search|find with: -- ### sonething ###
-- ### CLOCK POSITION - AND DEFAULTS ###
-- ### SET BORDER OPTIONS FOR "CLOCKS" ### -- I don't know how to remove this - NOT NEEDED
-- See lines 39 to 41 for overall size changes
-- ### START DIAL B ### Day Names Dial ###
-- See Lines 77 - 79 and 145 for changes
-- ### START DIAL C ### Month Names Dial ###
-- See Lines 143 -145 and 192 for changes
-- ### START DIAL D ### Day Numbers Dial ###
-- See Lines 226 & 257 for changes
-- ### START CLOCK A ###
-- See Lines & and 456 & 483 changes
-- MARKS AROUND CLOCK A -- Large Main 24 HR Clock
-- CLOCK A HOUR HAND
-- CLOCK A MINUTE HAND SETUP
-- CLOCK A SECOND HAND SETUP
-- PART SECOND HAND Lines: 503 519, 531
NOTE: Putting ### CLOCK A ### last insures that it's functions are written
over the other dials.
]]
require 'cairo'
-- ### CLOCK POSITION - AND DEFAULTS ##########################################
local init={
center_x=153, --from 135 = +40
center_y=153, --from 135
radius=140,
lang="English", -- English French Greek Spanish
hour=24, -- 12 | 24
second=true, --true | false - Seconds: dots and numbers IF 12HR
line=true, -- true | false - Part Second Hand
handday=false, -- DAY NAME hand - true or false
--handdaynum=false, -- DAY NUMBER hand - true or false
handmonth=false, -- MONTH NAME hand - true or false
color=0xFF0000, --color for day, day number and month IF NO SECOND HAND
alpha=1 --alpha for day, day number and month IF NO SECOND HAND
}
-- ONLY NEED ONE COPY OF THIS FUNCTION
function rgb_to_r_g_b(col,alp)
return ((col / 0x10000) % 0x100) / 255, ((col / 0x100) % 0x100) / 255, (col % 0x100) / 255, alp
end
local colr, colg, colb, cola=rgb_to_r_g_b(init.color,init.alpha)
function conky_main()
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)
cr = cairo_create(cs)
local extents=cairo_text_extents_t:create()
tolua.takeownership(extents)
-- ### CLOCK 12|24 HR SELECTOR ############################
local clock_type_A=init.hour
-- ############################ CLOCK 12|24 HR SELECTOR ###
-- ### SET BORDER OPTIONS FOR "CLOCKS" ####################
--local clock_border_width=0
-- set color and alpha for clock border
--local cbr,cbg,cbb,cba=1,1,1,1 -- full opaque white
-- gap from clock border to minute marks
local b_to_m=0
-- #################### SET BORDER OPTIONS FOR "CLOCKS" ###
-- ### START DIAL B ### Day Names Dial ####################
-- DIAL POSITION
local center_x=init.center_x
local center_y=init.center_y
local radius=42
-- FONT
cairo_select_font_face (cr, "CorporateMonoExtraBold", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 14)
-- TABLE OF TEXT -- in order
if init.lang == "English" then text_days={"Sun","Mon","Tue","Wed","Thr","Fri","Sat",} end
if init.lang == "French" then text_days={"dim","lun","mar","mer","jeu","ven","sam",} end
if init.lang == "Greek" then text_days={"ΔΕΥ","ΤΡΙ","ΤΕΤ","ΠΕΜ","ΠΑΡ","ΣΑΒ","ΚΥΡ",} end
if init.lang == "Spanish" then text_days={"dom","lun","mar","mie","jue","vie","sab",} end
local day_number=tonumber(os.date("%w"))
if init.handday == true then
for i=1,7 do
-- work out points
local point=(math.pi/180)*((360/7)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
local text=text_days[i]--gets text from table
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end
else
for i=1,7 do -- working out points
if day_number == i-1 then
cairo_set_source_rgba (cr,0.86,0.08,0.24,1.00) -- active colour
else
cairo_set_source_rgba (cr,1,1,1,0.07) -- non-active day names
end
local point=(math.pi/180)*((360/7)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
local text=text_days[i]--gets text from table
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end
-- INNER POINTS POSITION, radius smaller than text circle
local radius=27
for i=1,7 do
if day_number == i-1 then
cairo_set_source_rgba (cr,0.86,0.08,0.24,1.00) -- active colour
else
cairo_set_source_rgba (cr,1,1,1,0.07) -- non-active
end
local point=(math.pi/180)*((360/7)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
cairo_stroke (cr)
end
end
-- ######################################### END DIAL B ###
-- ### START DIAL C ### Month Names Dial ##################
-- DIAL POSITION
local center_x=init.center_x --(+85)
local center_y=init.center_y
local radius=73
-- FONT
cairo_select_font_face (cr, "CorporateMonoExtraBold", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 14)
-- TABLE OF TEXT -- in order
if init.lang == "English" then text_days={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",} end
if init.lang == "French" then text_days={"jan","fév","mar","avr","mai","jui","jul","aôu","sep","oct","nov","déc",} end
if init.lang == "Greek" then text_days={"ΙΑΝ","ΦΕΒ","ΜΑΡ","ΑΠΡ","ΜΑΙ","ΙΟΥ","ΙΟΥ","ΑΥΓ","ΣΕΠ","ΟΚΤ","ΝΟΕ","ΔΕΚ",} end
if init.lang == "Spanish" then text_days={"ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic",} end
local this_month=tonumber(os.date("%m"))
if init.handmonth == true then
for i=1,12 do
-- OUTER POINTS POSTION FOR -- ### START DIAL C ## TEXT
local point=(math.pi/180)*((360/12)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
local text=text_days[i]--gets text from table
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end
else
for i=1,12 do
if this_month == i then
cairo_set_source_rgba (cr,0.86,0.08,0.24,1.00) -- active month colour
else
cairo_set_source_rgba (cr,1,1,1,0.07) -- non-active month names
end
-- OUTTER POINTS POSTION FOR TEXT
local point=(math.pi/180)*((360/12)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
local text=text_days[i]--gets text from table
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end
-- INNER POINTS POSITION, radius smaller than text circle
local radius=58
for i=1,12 do
if this_month == i then
cairo_set_source_rgba (cr,0.86,0.08,0.24,1.00) -- active colour
else
cairo_set_source_rgba (cr,1,1,1,0.07) -- non-active month names
end
local point=(math.pi/180)*((360/12)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
cairo_stroke (cr)
end
end
-- ######################################### END DIAL C ###
-- ### START DIAL D ### Day Numbers Dial ##################
-- GET NUMBER OF DAYS IN CURRENT MONTH
-- calculate Feb, then set up table
year4num=os.date("%Y")
t1=os.time({year=year4num,month=03,day=01,hour=00,min=0,sec=0});
t2=os.time({year=year4num,month=02,day=01,hour=00,min=0,sec=0});
if init.hour == 12 then
febdaynum=tonumber((os.difftime(t1,t2))/(12*60*60))
else
febdaynum=tonumber((os.difftime(t1,t2))/(24*60*60))
end
-- MONTH TABLE to get number of days
monthdays={31,febdaynum,31,30,31,30,31,31,30,31,30,31}
this_month=tonumber(os.date("%m"))
number_days=monthdays[this_month]
-- TEXT positioning DAY #'s
local center_x=init.center_x
local center_y=init.center_y
local radius=105
cairo_select_font_face (cr, "Liquid Crystal", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 13)
local this_day=tonumber(os.date("%d"))
for i=1,number_days do
-- OUTTER POINTS POSTION FOR TEXT
local point=(math.pi/180)*((360/number_days)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
--only print even numbers
if math.mod(i, 2) == 0 and math.mod(this_day, 2)==0 then
text=string.format("%02d",i) --formats numbers to double digits
elseif math.mod(i, 2) ~= 0 and math.mod(this_day, 2)~=0 then
text=string.format("%02d",i) --formats numbers to double digits
else
text=""
end --odd even matching
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
if i==this_day then
cairo_set_source_rgba (cr,0.86,0.08,0.24,1.00) -- active colour
else
cairo_set_source_rgba (cr,1,1,1,0.35) -- dim inactive numbers
end
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end
-- INNER POINTS POSITION, radius smaller than text circle
local radius=90
for i=1,number_days do
local point=(math.pi/180)*((360/number_days)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
if i==this_day then
cairo_set_source_rgba (cr,0.86,0.08,0.24,1.00) -- active colour
else
cairo_set_source_rgba (cr,1,1,1,0.35) -- dim the points
end
cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
cairo_stroke (cr)
end
-- ######################################### END DIAL D ###
-- ### START CLOCK A ######################################
-- SET MARKS ###
-- MARKS AROUND CLOCK A -- Large Main 24 HR Clock
local number_marks_A=init.hour
-- set mark length
local m_length_A=0 -- doesn't work but can't delete
-- set mark width
local m_width_A=0 -- doesn't work but can't delete
-- set mark line cap type
local m_cap=CAIRO_LINE_CAP_ROUND
-- set mark color and alpha,red blue green alpha
local mr,mg,mb,ma=1,1,1,0 -- opaque white -- doesn't work but can't delete
-- SETUP HOUR HANDS ###
-- CLOCK A HOUR HAND
hh_length_A=90
-- set hour hand width
hh_width_A=4
-- set hour hand line cap
hh_cap=CAIRO_LINE_CAP_ROUND
-- set hour hand color
-- hhr,hhg,hhb,hha=1,0,1,0 -- fully opaque white --doesn't work
-- SETUP MINUTE HANDS ###
-- CLOCK A MINUTE HAND SETUP
-- set length of minute hand
mh_length_A=123
-- set minute hand width
mh_width_A=2
-- set minute hand line cap
mh_cap=CAIRO_LINE_CAP_ROUND
-- set minute hand color
--mhr,mhg,mhb,mha=1,1,1,0.5 -- fully opaque white --doesn't work
-- SETUP SECOND HAND ###
-- CLOCK A SECOND HAND SETUP -- DOESN'T WORK - Why ???????????????????????????
-- set length of seconds hand -- yes I know it is commented out!
--sh_length_A=150
-- set hour hand width
--sh_width_A=2
-- set hour hand line cap
--sh_cap=CAIRO_LINE_CAP_ROUND
-- set seconds hand color
--shr,shg,shb,sha=1,0,0,1 -- fully opaque red
-- PART SECOND HAND
--position
--get seconds value
local seconds=tonumber(os.date("%S"))
--calculate rotation of second hand in degrees
if init.line == true then
local arc=(math.pi/180)*((360/60)*seconds)
--calculate point 1
local radius1=120
local x1=0+radius1*math.sin(arc)
local y1=0-radius1*math.cos(arc)
--calculate point 2
local radius2=130
local x2=0+radius2*math.sin(arc)
local y2=0-radius2*math.cos(arc)
--draw line connecting points
cairo_move_to (cr, center_x+x1,center_y+y1)
cairo_line_to (cr, center_x+x2, center_y+y2)
cairo_set_source_rgba (cr,255/255,0/255,0/255,1) -- PART SECOND HAND
cairo_stroke (cr)
end
-- CLOCK A ### 12 HR TIME ###
-- CLOCK SETTINGS
clock_radius=0 --does not work
clock_centerx=init.center_x -- centre of Clock hands
clock_centery=init.center_y -- centre of Clock hands
-- DRAWING CODE
-- DRAW MARKS
-- stuff that can be moved outside of the loop, needs only be set once
-- calculate end and start radius for marks
m_end_rad=clock_radius-b_to_m
m_start_rad=m_end_rad-m_length_A -- WHAT IS THIS??
-- set line cap type
cairo_set_line_cap (cr, m_cap)
-- set line width
cairo_set_line_width (cr,m_width_A)
-- set color and alpha for marks
cairo_set_source_rgba (cr,mr,mg,mb,ma)
-- START LOOP FOR HOUR MARKS
for i=1,number_marks_A do
-- drawing code using the value of i to calculate degrees
-- calculate start point for 12/24 hour mark
radius=m_start_rad
point=(math.pi/180)*((i-1)*(360/number_marks_A))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- set start point for line
cairo_move_to (cr,clock_centerx+x,clock_centery+y)
-- calculate end point for 12/24 hour mark
radius=m_end_rad
point=(math.pi/180)*((i-1)*(360/number_marks_A))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- set path for line
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- draw the line
cairo_stroke (cr)
end -- of for loop
-- HOUR MARKS -- ???????????????????????????????????????????????????????????????
-- TIME CALCULATIONS CLOCK A
if clock_type_A==12 then
hours=tonumber(os.date("%I"))
-- convert hours to seconds
h_to_s=hours*60*60
elseif clock_type_A==24 then
hours=tonumber(os.date("%H"))
-- convert hours to seconds
h_to_s=hours*60*60
end
minutes=tonumber(os.date("%M"))
-- convert minutes to seconds
m_to_s=minutes*60
-- get current seconds
seconds=tonumber(os.date("%S"))
-- DRAW HOUR HAND ###
-- get hours minutes seconds as just seconds
hsecs=h_to_s+m_to_s+seconds
-- calculate degrees for each second
hsec_degs=hsecs*(360/(60*60*clock_type_A)) -- use equation ~ eliminate decimals
-- set radius to calculate hand points
radius=hh_length_A
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of hour hand
point=(math.pi/180)*hsec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes and draw line
cairo_set_line_width (cr,hh_width_A)
cairo_set_source_rgba (cr,0.4,0.6,0.6,1.0) -- active colour Hour Hand ================
cairo_set_line_cap (cr, hh_cap)
cairo_stroke (cr)
-- DRAW MINUTE HAND
-- get minutes and seconds just as seconds
msecs=m_to_s+seconds
-- calculate degrees for each second
msec_degs=msecs*0.1
-- set radius to calculate hand points
radius=mh_length_A
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of minute hand
point=(math.pi/180)*msec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes and draw line
cairo_set_line_width (cr,mh_width_A)
cairo_set_source_rgba (cr,0.4,0.6,0.6,1.0) -- active colour Minute Hand ==============
cairo_set_line_cap (cr, mh_cap)
cairo_stroke (cr)
-- ### CLOCK A ###
local center_x=init.center_x -- Centre of the HR / Min Numbers
local center_y=init.center_y -- Centre of the HR / Min Numbers
local radius=init.radius -- 12/24 HR CLOCK Hours/Minutes radius -- seeline 42
cairo_select_font_face (cr, "Liquid Crystal", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 13)
cairo_set_source_rgba (cr,1,1,1,1.0) -- HR Clock numbers
-- TABLE OF TEXT -- in order
if init.hour == 12 then
text_days={"12","01","02","03","04","05","06","07","08","09","10","11",}
for i=1,12 do
-- OUTTER POINTS POSTION FOR TEXT
local point=(math.pi/180)*((360/12)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
local text=text_days[i]--gets text from table
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_set_source_rgba (cr,1,1,1,1.0) -- colour of HR Numbers
cairo_stroke (cr)
end
-- INNER POINTS POSITION, radius smaller than text circle
local radius=124 -- 12 HR Clock
for i=1,12 do
local point=(math.pi/180)*((360/12)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
cairo_set_source_rgba (cr,1,1,1,0.50)
cairo_stroke (cr)
end
end
if init.hour == 24 then
text_days={"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23",}
for i=1,24 do
-- OUTTER POINTS POSTION FOR TEXT
local point=(math.pi/180)*((360/24)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
local text=text_days[i]--gets text from table
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end
-- INNER POINTS POSITION, radius smaller than text circle
local radius=124 -- 24 HR Clock
for i=1,24 do
local point=(math.pi/180)*((360/24)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
cairo_set_source_rgba (cr,1,1,1,0.4)
cairo_stroke (cr)
end
end
-- ############################################################################
-- POSITION FOR TEXT HOUR NUMBERS
if init.hour == 12 and init.second == true then
text_days={"","01","02","03","04","","06","07","08","09","","11","12","13","14","","16","17","18","19","","21","22","23","24","","26","27","28","29","","31","32","33","34","","36","37","38","39","","41","42","43","44","","46","47","48","49","","51","52","53","54","","56","57","58","59","",}
-- INNER POINTS POSITION, radius smaller than text circle
cairo_set_source_rgba (cr,1,1,1,0.07) -- does not work -- settings moved
cairo_select_font_face (cr, "monofur", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
for i=1,60 do
local radius=124 -- dots for seconds Clock A (12 dial)
local point=(math.pi/180)*((360/60)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
if seconds == i-1 then
cairo_set_source_rgba (cr,255/255,0/255,0/255,0.07) -- does not work - settings moved
else
if i-1 == 0 or i-1 == 5 or i-1 == 10 or i-1 == 15 or i-1 == 25 or i-1 == 30 or i-1 == 35 or i-1 == 40 or i-1 == 45 or i-1 == 50 or i-1 == 55 then
cairo_set_source_rgba (cr,0.4,0.6,0.6,1.0) -- active colour
else
cairo_set_source_rgba (cr,0,1,1,0.0) -- dots for seconds A Clock
end
end
cairo_arc (cr,center_x+x,center_y+y,1/2,0,2*math.pi)
cairo_stroke (cr)
end
radius=radius-3
cairo_set_font_size (cr, 10)
for i=1,60 do
-- OUTTER POINTS POSTION FOR TEXT
local point=(math.pi/180)*((360/60)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
local text=text_days[i]--gets text from table
if seconds == tonumber(text) then
cairo_set_source_rgba (cr,0.4,0.6,0.6,1.0) -- active colour
else
cairo_set_source_rgba (cr,1,1,1,0.15) -- seconds numbers
end
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end
end
-- ############################################################################
cairo_stroke (cr)
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end -- end main function
--[[ mrpeachy wrote:
the numbers are drawn using a for loop somewhere, like this
for i=1,12 do
calculate position of number
move_to(x,y)
show_text(i)
end
change it to something like this
for i=1,12 do
calculate position of number
if i==month_number then
move_to(x,y)
show_text(month_number)
else
move_to(x,y)
show_text(i)
end
end ]]
draw-bg.lua
--[[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 ~/wea_conky/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 ~/wea_conky/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
# 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=40,y=40,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=" ",gh=40,gt=25,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 #########################################################
Last edited by fvirgola80 (2016-05-27 11:49:52)
Nothing happens by chance
Offline
Nice one fvirgola80 Well done.
^ → "teamwork with Sector11" means I showed fvirgola80 how to change colours and where to change the fonts if required.
In some LUA scripts RGB rules the day for colours. And for the longest time I was at a total loss as to how to change those beyond the basic colours. nobody helped with a little python script to change the hex codes conky uses to RGB. Nice stuff that.
In the LUA script if you find something like this:
cbr,cbg,cbb,cba=1,1,1,1
or, in the case of the LUA script above:
cairo_set_source_rgba (cr,0,1,1,1)
the first three in the list, =1,1,1,1 or cr,0,1,1,1 are the RGB colours the last is the Alpha setting.
That python script will make things easier to find the colour you want..
ie:
27 May 16 @ 12:36:53 ~
$ rgb CD5C5C
CD5C5C rgb(0.80,0.36,0.36)
27 May 16 @ 12:37:01 ~
$
There are other LUA scripts that use HEX codes the same way conky does.
colour={ {0,0xF48F35,0.5} },
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
@Sector11
Nothing happens by chance
Offline
Beautiful job fvirgola80!
Links added on the first page.
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
Hello
I think i have (for a moment ) finished my weather station with Theo's Wubderground script . I remplace The accuweather line and that done this.
The one think i not have changed is the accuweather Alerts
@+
Last edited by loutch (2016-05-27 15:35:52)
Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX
Offline
Excellent, nice looking weather station loutch!
I like that (for a moment) - you have the bug.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Tremendous inspiration lately, well done everybody!
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
Beautiful job fvirgola80!
Links added on the first page.
:8
Nothing happens by chance
Offline
Great job loutch...
Nothing happens by chance
Offline
Tanks ,
i have a question .
Didier-t's script has many error than i would your help to hold that line
from this page
http://www.accuweather.com/fr/fr/sarreg … ast/135050
And if there is nothing write RAS.
Just a line to made it in the conkyrc if that is not so complicated .
Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX
Offline
I can't code but you probably need something that looks for "lfs-alarm" and reads between <p> & </p> on the next line.
<!-- /#forecast-feed -->
<!--YELLOW LFS button with ".lfs" on .fc-status-->
<div class="fc-status lfs">
<a href="http://www.accuweather.com/fr/fr/sarreguemines/135050/daily-weather-forecast/135050?day=2">
<table>
<tr>
<td class="icon"><i class="lfs-alarm"></i></td>
<td><p>Il y a aura des orages dans la zone samedi soir à Dimanche après-midi</p></td>
<td><em> </em></td>
</tr>
</table>
</a>
</div>
<!--forecast-status-->
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
I can't code to.
I would learn but i haven't the time to do it.
I know that is possible with wget something like this (i suppose
wget -O ~/.conky/conky-meteo/alerte http://www.accuweather.com/fr/fr/sarreguemines/135050/weather-forecast/135050 blablabla td><p></p></td>
Last edited by loutch (2016-05-27 21:30:47)
Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX
Offline
»»»»» This is for conky v1.90 «««««
The ConkyFV80chronograph Weather Station version 2
1b1)Accuweather - Images - 1b1_29-10-15- All users
1c)Accuweather Hourly Forecast - 1c_14-3-16
4) Moon phases' script - 4_2-6-15
Required for this layout:
conky font: monofur
Chronograph.lua
Chronograph.lua fonts: monofur, Liquid Crystal, CorporateMonoExtraBold
Nice to have:
draw-bg.lua
WARNING: Check the "paths" these are in:
/home/fvirgola80/1b1_accuweather_images/
/home/fvirgola80/4_Moon/
/home/fvirgola80/1c_accuweather_images_hourly/
ChronographFV80.conky
# To use #! in a conky use: ${exec echo '#!'}
# killall conky && conky -c ~/Conky/ChronographFV80WS..conk &
### Begin Window Settings ##################################################
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints skip_taskbar,skip_pager,undecorated,below ## undecorated,below,skip_taskbar,skip_pager
#own_window_colour gray
own_window_class Conky
own_window_title Chronograph
# 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
### ARGB can be used for real transparency
### NOTE that a composite manager is required for real transparency.
### This option will not work as desired (in most cases) in conjunction with
### own_window_type normal
### own_window_argb_visual yes
### When ARGB visuals are enabled, this use this to modify the alpha value
### Use: own_window_type normal
### Use: own_window_transparent no
### Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
# own_window_argb_value 0
minimum_size 340 770 ##420 420 ## width, height
maximum_width 340 ##420 ## width, usually a good idea to equal minimum width
gap_x 10 #15 ### left &right
gap_y 10 ### up & down
alignment tl #ml
#################################################### End Window Settings ###
### Font Settings ##########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
xftfont monofur:bold:size=9
# Alpha of Xft font. Must be a value at or between 1 and 0 ###
xftalpha 1
# Force UTF8? requires XFT ###
override_utf8_locale yes
draw_shades no
default_shade_color black
draw_outline no # amplifies text if yes
default_outline_color black
uppercase no
###################################################### End Font Settings ###
### Color Settings #########################################################
default_shade_color gray
default_outline_color black
default_color DCDCDC #220 220 220 Gainsboro
color0 8FBC8F #143 188 143 DarkSeaGreen
color1 778899 #119 136 153 LightSlateGray
color2 FF8C00 #255 140 0 DarkOrange
color3 7FFF00 #127 255 0 Chartreuse
color4 FFA07A #255 160 122 LightSalmon
color5 FFDEAD #255 222 173 NavajoWhite
color6 00BFFF # 0 191 255 DeepSkyBlue
color7 00FFFF # 0 255 255 Cyan
color8 FFFF00 #255 255 0 Yellow
color9 B22222 #178 34 34 FireBrick
##################################################### End Color Settings ###
### Borders Section ########################################################
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
border_inner_margin 5
border_outer_margin 0
# border width
border_width 0
# 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
# Default and Minimum size is 256 - needs more for single commands that
# "call" a lot of text IE: bash scripts
text_buffer_size 256
# Subtract (file system) buffers from used memory?
no_buffers yes
# change GiB to G and MiB to M
short_units yes
# Like it says, ot pads the decimals on % values
# doesn't seem to work since v1.7.1
pad_percents 2
# Maximum size of user text buffer, i.e. layout below TEXT line in config file
# (default is 16384 bytes)
# max_user_text 16384
# Desired output unit of all objects displaying a temperature. Parameters are
# either "fahrenheit" or "celsius". The default unit is degree Celsius.
# temperature_unit Fahrenheit
############################################## End Miscellaneous Section ###
### LUA Settings ###########################################################
## Above and After TEXT - requires a composite manager or blinks.
##
# lua_load ~/Conky/LUA/draw-bg.lua
#TEXT
# ${lua conky_draw_bg 125 0 0 0 0 0x000000 0.3}
#
## ${lua conky_draw_bg corner_radius x_position y_position width height color alpha}
##
## OR Both above TEXT (No composite manager required - no blinking!)
#
#--------------------------------
# lua_load /home/fvirgola80/.config/conky/LUA/draw-bg.lua
# lua_draw_hook_pre draw_bg 20 0 0 0 0 0x000000 0.3
# lua_draw_hook_post draw-bg 125 0 0 0 0 0x000000 0.01
#
# TEXT
##
#
################### Chronograph ##############################################
lua_load /home/fvirgola80/.config/conky/LUA/Chronograph.lua
lua_draw_hook_post main
#lua_load ~/Conky/LUA/chrono.lua
#lua_load ~/Conky/LUA/clock_rings_mrp.lua
####################################################### End LUA Settings ###
# The all important - How often conky refreshes.
# If you have a "Crey" try: 0.2 - smokin' - but watch the CPU useage go UP!
update_interval 1
TEXT
${execi 600 /home/fvirgola80/1b1_accuweather_images/1b1}\
${execi 600 /home/fvirgola80/4_Moon/moon_MoonGiant}\
${execi 600 /home/fvirgola80/1c_accuweather_images_hourly/1c}\
${image /home/fvirgola80/images/bk_30.png -p -2,-5 -s 345x765}\
${image $HOME/images/LightSlateGrey_1.png -p 170,430 -s 2x328}\
${font monofur:bold:size=10}${color9}↑:${execi 600 sed -n '26p' $HOME/1b1_accuweather_images/first_days}°${alignr 5}\
T:${execi 600 sed -n '29p' $HOME/1b1_accuweather_images/curr_cond}°${color}
${color6}↓:${execi 600 sed -n '31p' $HOME/1b1_accuweather_images/first_days}°${alignr 5}\
${color6}±:${execi 600 sed -n '30p' $HOME/1b1_accuweather_images/curr_cond}°${color}${font}
${image /home/fvirgola80/1b1_accuweather_images/cc.png -p 40,145 -s 108x65}\
${image /home/fvirgola80/4_Moon/0.png -p 236,150 -s 50x50}\
${color5}S.Rise${alignr 5}S.Set
${color7}${execi 600 sed -n '39p' /home/fvirgola80/1b1_accuweather_images/curr_cond}${alignr 5}${execi 90 sed -n '40p' /home/fvirgola80/1b1_accuweather_images/curr_cond}
${color5}Hum${alignr 5}D.P.${color}
${color7}${execi 600 sed -n '32p' /home/fvirgola80/1b1_accuweather_images/curr_cond}${alignr 5}${execi 90 sed -n '35p' /home/fvirgola80/1b1_accuweather_images/curr_cond}°${color}
${color5}Pressure${alignr 5}UV Index${color}
${color7}${execi 600 sed -n '33p' /home/fvirgola80/1b1_accuweather_images/curr_cond}${alignr 5}${execi 600 sed -n '34p' /home/fvirgola80/1b1_accuweather_images/curr_cond} /11${color}${font}
${font monofur:bold:size=11}${alignc}${execpi 600 sed -n '1p' $HOME/1b1_accuweather_images/messages}${font}
${color5}Wind ${color7}${execi 90 sed -n '31p' /home/fvirgola80/1b1_accuweather_images/curr_cond}${alignr 5}${color5}←→ ${color7}${execi 90 sed -n '38p' /home/fvirgola80/1b1_accuweather_images/curr_cond}${color}
${color5}Cld ${color7}${execi 90 sed -n '36p' /home/fvirgola80/1b1_accuweather_images/curr_cond}${alignr 5}${color5}Vis${color7} ${execi 90 sed -n '37p' /home/fvirgola80/1b1_accuweather_images/curr_cond}${color}
${alignc}${color5}The current moon phase is ${color7}${execi 600 sed -n '7p' /home/fvirgola80/4_Moon/raw}${color}
${color5}Distance ${color7}${execi 600 sed -n '4p' $HOME/4_Moon/raw | cut -c-3} K/km${alignr 5}${color5}Visible ${color7}${execi 600 sed -n '1p' /home/fvirgola80/4_Moon/raw}${color}
${color5}Moon Age ${color7}${execi 600 sed -n '5p' /home/fvirgola80/4_Moon/raw} days${alignr 5}${color5}Moon Angle ${color7}${execi 600 sed -n '6p' /home/fvirgola80/4_Moon/raw}°${color}
${color5}Moonrise ${color7}${execi 90 sed -n '41p' /home/fvirgola80/1b1_accuweather_images/curr_cond}${alignr 5}${color5}Moonset ${color7}${execi 90 sed -n '42p' /home/fvirgola80/1b1_accuweather_images/curr_cond}${color}
${goto 37}${execi 3600 echo `date --date="1 day" | awk '{print $1" "$3" "$2}'`}\
${goto 180}${execi 600 sed -n '2p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${goto 285}${execpi 600 sed -n '3p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${image /home/fvirgola80/1c_accuweather_images_hourly/20.png -p 185,450 -s 70x45}\
${image /home/fvirgola80/1c_accuweather_images_hourly/23.png -p 285,450 -s 70x45}\
${image /home/fvirgola80/1b1_accuweather_images/6.png -p 53,450 -s 70x45}
${goto 30}${color9}↑↑ ${execi 90 sed -n '8p' /home/fvirgola80/1b1_accuweather_images/first_days}°\
${goto 180}${execpi 600 sed -n '52p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${goto 285}${execpi 600 sed -n '53p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}${color}
${goto 240} » » »
${goto 30}${color7}↓↓ ${execi 90 sed -n '9p' /home/fvirgola80/1b1_accuweather_images/first_days}°\
${goto 180}±${execpi 600 sed -n '61p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${goto 285}±${execpi 600 sed -n '62p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}${color}
${execi 3600 echo `date --date="2 day" | awk '{print $1" "$3" "$2}'`}\
${goto 90}${execi 3600 echo `date --date="3 day" | awk '{print $1" "$3" "$2}'`}\
${goto 180}${execpi 600 sed -n '4p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${goto 285}${execpi 600 sed -n '5p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${image /home/fvirgola80/1b1_accuweather_images/11.png -p 10,515 -s 70x45}\
${image /home/fvirgola80/1b1_accuweather_images/16.png -p 100,515 -s 70x45}\
${image /home/fvirgola80/1c_accuweather_images_hourly/26.png -p 185,515 -s 70x45}\
${image /home/fvirgola80/1c_accuweather_images_hourly/29.png -p 285,515 -s 70x45}
${goto 0}${color9}↑↑${execi 90 sed -n '13p' /home/fvirgola80/1b1_accuweather_images/first_days}°\
${goto 90}↑↑${execi 90 sed -n '18p' /home/fvirgola80/1b1_accuweather_images/first_days}°\
${goto 180}${execpi 600 sed -n '57p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${goto 285}${execpi 600 sed -n '58p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}${color}
${goto 65} » » ${goto 240} » » »
${goto 0}${color7}↓↓${execi 90 sed -n '14p' /home/fvirgola80/1b1_accuweather_images/first_days}°\
${goto 90}↓↓${execi 90 sed -n '19p' /home/fvirgola80/1b1_accuweather_images/first_days}°${color}\
${goto 180}±${execpi 600 sed -n '61p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${goto 285}±${execpi 600 sed -n '64p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}${color}
${execi 3600 echo `date --date="4 day" | awk '{print $1" "$3" "$2}'`}\
${goto 90}${execi 3600 echo `date --date="5 day" | awk '{print $1" "$3" "$2}'`}\
${goto 180}${execpi 600 sed -n '6p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${goto 285}${execpi 600 sed -n '7p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${image /home/fvirgola80/1b1_accuweather_images/21.png -p 10,580 -s 70x45}\
${image /home/fvirgola80/1b1_accuweather_images/last_2.png -p 100,580 -s 70x45}\
${image /home/fvirgola80/1c_accuweather_images_hourly/32.png -p 185,580 -s 70x45}\
${image /home/fvirgola80/1c_accuweather_images_hourly/35.png -p 285,580 -s 70x45}
${goto 0}${color9}↑↑${execi 90 sed -n '23p' /home/fvirgola80/1b1_accuweather_images/first_days}°\
${goto 90}↑↑${execi 90 sed -n '4p' /home/fvirgola80/1b1_accuweather_images/last_days}°\
${goto 180}${execpi 600 sed -n '56p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${goto 285}${execpi 600 sed -n '57p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}${color}
${goto 65} » » ${goto 240} » » »
${goto 0}${color7}↓↓${execi 90 sed -n '24p' /home/fvirgola80/1b1_accuweather_images/first_days}°\
${goto 90}↓↓${execi 90 sed -n '5p' /home/fvirgola80/1b1_accuweather_images/last_days}°\
${goto 180}±${execpi 600 sed -n '65p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${goto 285}±${execpi 600 sed -n '66p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}${color}
${execi 3600 echo `date --date="6 day" | awk '{print $1" "$3" "$2}'`}\
${goto 90}${execi 3600 echo `date --date="7 day" | awk '{print $1" "$3" "$2}'`}\
${goto 180}${execi 600 sed -n '8p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${goto 285}${execi 600 sed -n '9p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${image /home/fvirgola80/1b1_accuweather_images/last_7.png -p 10,645 -s 70x45}\
${image /home/fvirgola80/1b1_accuweather_images/last_12.png -p 100,645 -s 70x45}\
${image /home/fvirgola80//1c_accuweather_images_hourly/38.png -p 185,645 -s 70x45}\
${image /home/fvirgola80//1c_accuweather_images_hourly/41.png -p 285,645 -s 70x45}
${goto 0}${color9}↑↑${execi 90 sed -n '9p' /home/fvirgola80/1b1_accuweather_images/last_days}°\
${goto 90}↑↑${execi 90 sed -n '14p' /home/fvirgola80/1b1_accuweather_images/last_days}°\
${goto 180}${execi 600 sed -n '58p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${goto 285}${execpi 600 sed -n '59p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}${color}
${goto 65} » » ${goto 240} » » »
${goto 0}${color7}↓↓${execi 90 sed -n '10p' /home/fvirgola80/1b1_accuweather_images/last_days}°\
${goto 90}↓↓${execi 90 sed -n '15p' /home/fvirgola80/1b1_accuweather_images/last_days}°\
${goto 180}±${execpi 600 sed -n '67p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}\
${goto 285}±${execpi 600 sed -n '68p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw1}${color}
${execi 3600 echo `date --date="8 day" | awk '{print $1" "$3" "$2}'`}\
${goto 90}${execi 3600 echo `date --date="9 day" | awk '{print $1" "$3" "$2}'`}\
${goto 180}${execpi 10 sed -n '2p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw2}\
${goto 285}${execpi 10 sed -n '3p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw2}\
${image /home/fvirgola80/1b1_accuweather_images/last_17.png -p 10,710 -s 70x45}\
${image /home/fvirgola80/1b1_accuweather_images/last_22.png -p 100,710 -s 70x45}\
${image /home/fvirgola80//1c_accuweather_images_hourly/120.png -p 185,710 -s 70x45}\
${image /home/fvirgola80//1c_accuweather_images_hourly/123.png -p 285,710 -s 70x45}
${goto 0}${color9}↑↑${execi 90 sed -n '19p' /home/fvirgola80/1b1_accuweather_images/last_days}°\
${goto 90}↑↑${execi 90 sed -n '24p' /home/fvirgola80/1b1_accuweather_images/last_days}\
${goto 180}${execpi 10 sed -n '52p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw2}\
${goto 285}${execpi 10 sed -n '53p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw2}${color}
${goto 65} » » ${goto 240} » » »
${goto 0}${color7}↓↓${execi 90 sed -n '20p' /home/fvirgola80/1b1_accuweather_images/last_days}°\
${goto 90}↓↓${execi 90 sed -n '25p' /home/fvirgola80/1b1_accuweather_images/last_days}°\
${goto 180}±${execpi 10 sed -n '61p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw2}\
${goto 285}±${execpi 10 sed -n '61p' /home/fvirgola80/1c_accuweather_images_hourly/hourly_raw2}${color}
${color1}${membar 0,160} ${membar 0,160}${color}
Chronograph.lua
--[[ multiple analogue clocks by mrpeachy - 28 May 2016
28 May 2016 - Chronograph modifications by FV80
use in conkyrc
lua_load /path/Chronograph.lua
lua_draw_hook_pre main
TEXT
-- INDEX (use find with):
-- ###### 12 OR 24 CLOCK FACE
-- SET BORDER OPTIONS ###### ALL CLOCKS
-- ### START CLOCK A ######################################
-- MARKS AROUND CLOCK A -- Large Main 24 HR Clock
-- CLOCK A HOUR HAND
-- CLOCK A MINUTE HAND SETUP
-- CLOCK A SECOND HAND SETUP
-- CLOCK A ###### 24 HR TIME
-- ### START DIAL B ### Top - Week Day Names Dial #########
-- ### START DIAL C ### Right - Month Names Dial ##########
-- ### START DIAL D ### Left - Day Numbers Dial ###########
-- ### START CLOCK E ######################################
-- MARKS AROUND CLOCK E -- Bottom - 12 HR Clock
-- CLOCK E HOUR HAND
-- CLOCK E MINUTE HAND SETUP
-- CLOCK E SECOND HAND SETUP
-- CLOCK E ###### 12 HR TIME
NOTE: Putting ### CLOCK A ### last insures that it's functions are written
over the other dials.
]]
require 'cairo'
function conky_main()
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)
cr = cairo_create(cs)
-- ########################################################
-- SETTINGS AREA
-- local cpu=conky_parse("${cpu}")
-- local red-1=conky_parse("${image ~/Conky/images/red_1.png -p 0,0 -s 35x35}")
-- ###### 12 OR 24 CLOCK FACE #############################
local clock_type_A=24 -- Large Main 24 HR Clock
local clock_type_E=12 -- Bottom - 12 HR Clock
-- ###### CLOCK SETTINGS ##################################
-- SET BORDER OPTIONS FOR "CLOCKS" ########################
local clock_border_width=0
-- set color and alpha for clock border
local cbr,cbg,cbb,cba=1,1,1,1 -- full opaque white
-- gap from clock border to minute marks
local b_to_m=1
-- ########################################################
-- ### START DIAL B ### Top - Week Day Names Dial #########
-- DIAL POSITION FOR TEXT
local center_x=175
local center_y=95
local radius=50
-- FONT
cairo_select_font_face (cr, "CorporateMonoExtraBold", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 10)
cairo_set_source_rgba (cr,194/255,204/255,255/255,1) -- (cr,1,1,1,1)
-- TABLE OF TEXT -- in order
text_days={"SUN","MON","TUE","WED","THR","FRI","SAT",}
-- text_days={"DOM","LUN","MAR","MIE","JUE","VIE","SAB",}
for i=1,7 do
-- work out points
local point=(math.pi/180)*((360/7)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
local text=text_days[i]--gets text from table
local extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end
-- INNER POINTS POSITION, radius smaller than text circle
local radius=35
for i=1,7 do
local point=(math.pi/180)*((360/7)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
cairo_stroke (cr)
end
-- DRAW HAND -- snaps to current day of week
local hand_length=30
local day_number=tonumber(os.date("%w"))
local point=(math.pi/180)*((360/7)*(day_number))
local x=0+hand_length*(math.sin(point))
local y=0-hand_length*(math.cos(point))
local hand_width=2
cairo_move_to (cr,center_x,center_y)
cairo_line_to (cr,center_x+x,center_y+y)
cairo_stroke (cr)
-- ### END DIAL B #########################################
-- ########################################################
-- ### START DIAL C ### Right - Month Names Dial ##########
-- DIAL POSITION FOR TEXT
local center_x=260
local center_y=175
local radius=45
-- FONT
cairo_select_font_face (cr, "CorporateMonoExtraBold", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 10)
cairo_set_source_rgba (cr,194/255,204/255,255/255,1) -- (cr,1,1,1,1)
-- TABLE OF TEXT -- in order
text_days={"JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC",}
-- text_days={"ENE","FEB","MAR","ABR","MAY","JUN","JUL","AGO","SEP","OCT","NOV","DIC",}
for i=1,12 do
-- OUTTER POINTS POSTION FOR TEXT
local point=(math.pi/180)*((360/12)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
local text=text_days[i]--gets text from table
local extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end
-- INNER POINTS POSITION, radius smaller than text circle
local radius=32
for i=1,12 do
local point=(math.pi/180)*((360/12)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
cairo_stroke (cr)
end
-- DRAW HAND -- snaps to current month
local this_month=tonumber(os.date("%m"))
local hand_length=28 --radius for this calculation
local point=(math.pi/180)*((360/12)*(this_month-1))
local x=0+hand_length*(math.sin(point))
local y=0-hand_length*(math.cos(point))
cairo_move_to (cr,center_x,center_y)
cairo_line_to (cr,center_x+x,center_y+y)
cairo_stroke (cr)
-- ### END CLOCK C ########################################
-- ########################################################
-- ### START DIAL D ### Left - Day Numbers Dial ###########
-- GET NUMBER OF DAYS IN CURRENT MONTH
-- calculate Feb, then set up table
year4num=os.date("%Y")
t1=os.time({year=year4num,month=03,day=01,hour=00,min=0,sec=0});
t2=os.time({year=year4num,month=02,day=01,hour=00,min=0,sec=0});
febdaynum=tonumber((os.difftime(t1,t2))/(24*60*60))
-- MONTH TABLE
monthdays={31,febdaynum,31,30,31,30,31,31,30,31,30,31}
this_month=tonumber(os.date("%m"))
number_days=monthdays[this_month]
-- TEXT positioning
local center_x=95
local center_y=175
local radius=50
cairo_select_font_face (cr, "CorporateMonoExtraBold", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 8)
cairo_set_source_rgba (cr,194/255,204/255,255/255,1) -- (cr,1,1,1,1)
for i=1,number_days do
-- OUTTER POINTS POSTION FOR TEXT
local point=(math.pi/180)*((360/number_days)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
local text=i
local extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end
-- INNER POINTS POSITION, radius smaller than text circle
local radius=40
for i=1,number_days do
local point=(math.pi/180)*((360/number_days)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
cairo_stroke (cr)
end
-- DRAW HAND -- snaps to current DAY
local this_day=tonumber(os.date("%d"))
local hand_length=35--radius for this calculation
local point=(math.pi/180)*((360/number_days)*(this_day-1))
local x=0+hand_length*(math.sin(point))
local y=0-hand_length*(math.cos(point))
cairo_move_to (cr,center_x,center_y)
cairo_line_to (cr,center_x+x,center_y+y)
cairo_stroke (cr)
-- ### END CLOCK D ########################################
-- ########################################################
-- ### START CLOCK E ######################################
-- MARKS AROUND CLOCK E -- Bottom - 12 HR Clock
local number_marks_E=12
-- set mark length
local m_length_E=0
-- set mark width
local m_width_E=0
-- set mark line cap type
local m_cap=CAIRO_LINE_CAP_ROUND
-- set mark color and alpha,red blue green alpha
local mr,mg,mb,ma=1,1,0,1-- opaque white
-- SETUP HOUR HANDS #######################################
-- CLOCK E HOUR HAND
-- set length of hour hand
hh_length_E=25
-- set hour hand width
hh_width_E=2
-- set hour hand line cap
hh_cap=CAIRO_LINE_CAP_ROUND
-- set hour hand color
hhr,hhg,hhb,hha=1,1,0,1-- fully opaque white
-- SETUP MINUTE HANDS #####################################
-- CLOCK E MINUTE HAND SETUP
-- set length of minute hand
mh_length_E=35
-- set minute hand width
mh_width_E=2
-- set minute hand line cap
mh_cap=CAIRO_LINE_CAP_ROUND
-- set minute hand color
mhr,mhg,mhb,mha=1,1,0,1-- fully opaque white
-- SETUP SECOND HANDS #####################################
-- CLOCK E SECOND HAND SETUP
-- set length of seconds hand
sh_length_E=32
-- set hour hand width
sh_width_E=1
-- set hour hand line cap
sh_cap=CAIRO_LINE_CAP_ROUND
-- set seconds hand color
shr,shg,shb,sha=1,0,0,1-- fully opaque red
-- CLOCK E ###### 12 HR TIME ##############################
-- CLOCK SETTINGS
clock_radius=45
clock_centerx=175
clock_centery=260
-- DRAWING CODE
-- DRAW BORDER
cairo_set_source_rgba (cr,cbr,cbg,cbb,cba)
cairo_set_line_width (cr,clock_border_width)
cairo_arc (cr,clock_centerx,clock_centery,clock_radius,0,2*math.pi)
cairo_stroke (cr)
-- DRAW MARKS
-- stuff that can be moved outside of the loop, needs only be set once
-- calculate end and start radius for marks
m_end_rad=clock_radius-b_to_m
m_start_rad=m_end_rad-m_length_E
-- set line cap type
cairo_set_line_cap (cr, m_cap)
-- set line width
cairo_set_line_width (cr,m_width_E)
-- set color and alpha for marks
cairo_set_source_rgba (cr,mr,mg,mb,ma)
-- START LOOP FOR SECOND MARKS
for i=1,number_marks_E do
-- drawing code using the value of i to calculate degrees
-- calculate start point for 12/24 hour mark
radius=m_start_rad
point=(math.pi/180)*((i-1)*(360/number_marks_E))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- set start point for line
cairo_move_to (cr,clock_centerx+x,clock_centery+y)
-- calculate end point for 12/24 hour mark
radius=m_end_rad
point=(math.pi/180)*((i-1)*(360/number_marks_E))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- set path for line
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- draw the line
cairo_stroke (cr)
end-- of for loop
-- TIME CALCULATIONS CLOCK E
if clock_type_E==12 then
hours=tonumber(os.date("%I"))
-- convert hours to seconds
h_to_s=hours*60*60
elseif clock_type_E==24 then
hours=tonumber(os.date("%H"))
-- convert hours to seconds
h_to_s=hours*60*60
end
minutes=tonumber(os.date("%M"))
-- convert minutes to seconds
m_to_s=minutes*60
-- get current seconds
seconds=tonumber(os.date("%S"))
-- DRAW HOUR HAND
-- get hours minutes seconds as just seconds and draw it
hsecs=h_to_s+m_to_s+seconds
-- calculate degrees for each second
hsec_degs=hsecs*(360/(60*60*clock_type_E))-- use equation ~ eliminate decimals
-- set radius to calculate hand points
radius=hh_length_E
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of minute hand
point=(math.pi/180)*hsec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes and draw line
cairo_set_line_width (cr,hh_width_E)
cairo_set_source_rgba (cr,hhr,hhg,hhb,hha)
cairo_set_line_cap (cr, hh_cap)
cairo_stroke (cr)
-- DRAW MINUTE HAND
-- get minutes and seconds as seconds
msecs=m_to_s+seconds
-- calculate degrees for each second
msec_degs=msecs*0.1
-- set radius to calculate hand points
radius=mh_length_E
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of minute hand
point=(math.pi/180)*msec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes and draw line
cairo_set_line_width (cr,mh_width_E)
cairo_set_source_rgba (cr,mhr,mhg,mhb,mha)
cairo_set_line_cap (cr, mh_cap)
cairo_stroke (cr)
-- DRAW SECOND HAND
-- calculate degrees for each second
sec_degs=seconds*6
-- set radius to calculate hand points
radius=sh_length_E
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of seconds hand
point=(math.pi/180)*sec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes
cairo_set_line_width (cr,sh_width_E)
cairo_set_source_rgba (cr,shr,shg,shb,sha)
cairo_set_line_cap (cr, sh_cap)
cairo_stroke (cr)
-- POSITION FOR TEXT HOUR NUMBERS
local center_x=175
local center_y=260
local radius=45
-- FONT
cairo_select_font_face (cr, "CorporateMonoExtraBold", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 10)
cairo_set_source_rgba (cr,194/255,204/255,255/255,1) -- (cr,1,1,1,1)
-- TABLE OF TEXT -- in order
--text_days={"12","01","02","03","04","05","06","07","08","09","10","11",}
-- FOR A 12 HOUR CLOCK WITH THE NUMBERS 13-00
text_days={"00","13","14","15","16","17","18","19","20","21","22","23",}
for i=1,12 do
-- OUTTER POINTS POSTION FOR TEXT
local point=(math.pi/180)*((360/12)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
local text=text_days[i]--gets text from table
local extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end
-- INNER POINTS POSITION, radius smaller than text circle
local radius=32
for i=1,12 do
local point=(math.pi/180)*((360/12)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
cairo_stroke (cr)
end
-- ### END CLOCK E ########################################
-- ########################################################
-- ### START CLOCK A ######################################
-- SET MARKS ##############################################
-- MARKS AROUND CLOCK A -- Large Main 24 HR Clock
local number_marks_A=24
-- set mark length
local m_length_A=0
-- set mark width
local m_width_A=0
-- set mark line cap type
local m_cap=CAIRO_LINE_CAP_ROUND
-- set mark color and alpha,red blue green alpha
local mr,mg,mb,ma=1,1,1,1-- opaque white
-- SETUP HOUR HANDS #######################################
-- CLOCK A HOUR HAND
-- set length of hour hand
hh_length_A=130
-- set hour hand width
hh_width_A=3
-- set hour hand line cap
hh_cap=CAIRO_LINE_CAP_ROUND
-- set hour hand color
hhr,hhg,hhb,hha=1,1,1,1-- fully opaque white
-- SETUP MINUTE HANDS #####################################
-- CLOCK A MINUTE HAND SETUP
-- set length of minute hand
mh_length_A=145
-- set minute hand width
mh_width_A=2
-- set minute hand line cap
mh_cap=CAIRO_LINE_CAP_ROUND
-- set minute hand color
mhr,mhg,mhb,mha=1,1,1,1-- fully opaque white
-- SETUP SECOND HANDS #####################################
-- CLOCK A SECOND HAND SETUP
-- set length of seconds hand
sh_length_A=150
-- set hour hand width
sh_width_A=2
-- set hour hand line cap
sh_cap=CAIRO_LINE_CAP_ROUND
-- set seconds hand color
shr,shg,shb,sha=1,0,0,1-- fully opaque red
-- CLOCK A ###### 24 HR TIME ##############################
-- CLOCK SETTINGS
clock_radius=200
clock_centerx=175
clock_centery=175
-- DRAWING CODE
-- DRAW BORDER
cairo_set_source_rgba (cr,cbr,cbg,cbb,cba)
cairo_set_line_width (cr,clock_border_width)
cairo_arc (cr,clock_centerx,clock_centery,clock_radius,0,2*math.pi)
cairo_stroke (cr)
-- DRAW MARKS
-- stuff that can be moved outside of the loop, needs only be set once
-- calculate end and start radius for marks
m_end_rad=clock_radius-b_to_m
m_start_rad=m_end_rad-m_length_A
-- set line cap type
cairo_set_line_cap (cr, m_cap)
-- set line width
cairo_set_line_width (cr,m_width_A)
-- set color and alpha for marks
cairo_set_source_rgba (cr,mr,mg,mb,ma)
-- START LOOP FOR HOUR MARKS
for i=1,number_marks_A do
-- drawing code using the value of i to calculate degrees
-- calculate start point for 12/24 hour mark
radius=m_start_rad
point=(math.pi/180)*((i-1)*(360/number_marks_A))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- set start point for line
cairo_move_to (cr,clock_centerx+x,clock_centery+y)
-- calculate end point for 12/24 hour mark
radius=m_end_rad
point=(math.pi/180)*((i-1)*(360/number_marks_A))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- set path for line
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- draw the line
cairo_stroke (cr)
end-- of for loop
-- HOUR MARKS
-- TIME CALCULATIONS CLOCK A
if clock_type_A==12 then
hours=tonumber(os.date("%I"))
-- convert hours to seconds
h_to_s=hours*60*60
elseif clock_type_A==24 then
hours=tonumber(os.date("%H"))
-- convert hours to seconds
h_to_s=hours*60*60
end
minutes=tonumber(os.date("%M"))
-- convert minutes to seconds
m_to_s=minutes*60
-- get current seconds
seconds=tonumber(os.date("%S"))
-- DRAW HOUR HAND
-- get hours minutes seconds as just seconds
hsecs=h_to_s+m_to_s+seconds
-- calculate degrees for each second
hsec_degs=hsecs*(360/(60*60*clock_type_A))-- use equation ~ eliminate decimals
-- set radius to calculate hand points
radius=hh_length_A
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of hour hand
point=(math.pi/180)*hsec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes and draw line
cairo_set_line_width (cr,hh_width_A)
cairo_set_source_rgba (cr,hhr,hhg,hhb,hha)
cairo_set_line_cap (cr, hh_cap)
cairo_stroke (cr)
-- DRAW MINUTE HAND
-- get minutes and seconds just as seconds
msecs=m_to_s+seconds
-- calculate degrees for each second
msec_degs=msecs*0.1
-- set radius to calculate hand points
radius=mh_length_A
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of minute hand
point=(math.pi/180)*msec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes and draw line
cairo_set_line_width (cr,mh_width_A)
cairo_set_source_rgba (cr,mhr,mhg,mhb,mha)
cairo_set_line_cap (cr, mh_cap)
cairo_stroke (cr)
-- DRAW SECOND HAND
--[[
-- calculate degrees for each second
sec_degs=seconds*6
-- set radius to calculate hand points
radius=sh_length_A
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of seconds hand
point=(math.pi/180)*sec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes
cairo_set_line_width (cr,sh_width_A)
cairo_set_source_rgba (cr,shr,shg,shb,sha)
cairo_set_line_cap (cr, sh_cap)
cairo_stroke (cr)
]]
-- ####################################################################
-- part of a second hand
--position
local center_x=175
local center_y=175
--get seconds value
local seconds=tonumber(os.date("%S"))
--calculate rotation of second hand in degrees
local arc=(math.pi/180)*((360/60)*seconds)
--calculate point 1
local radius1=149
local x1=0+radius1*math.sin(arc)
local y1=0-radius1*math.cos(arc)
--calculate point 2
local radius2=151
local x2=0+radius2*math.sin(arc)
local y2=0-radius2*math.cos(arc)
--draw line connecting points
cairo_move_to (cr, center_x+x1,center_y+y1)
cairo_line_to (cr, center_x+x2, center_y+y2)
cairo_set_source_rgba (cr,255/255,0/255,0/255,1)
cairo_stroke (cr)
-- ####################################################################
-- POSITION FOR TEXT HOUR NUMBERS
local center_x=175
local center_y=175
local radius=160
-- FONT
cairo_select_font_face (cr, "CorporateMonoExtraBold", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 10)
cairo_set_source_rgba (cr,1,1,1,1)
-- TABLE OF TEXT -- in order
text_days={"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23",}
for i=1,24 do
-- OUTTER POINTS POSTION FOR TEXT
local point=(math.pi/180)*((360/24)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
local text=text_days[i]--gets text from table
local extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end
-- INNER POINTS POSITION, radius smaller than text circle
local radius=150
for i=1,24 do
local point=(math.pi/180)*((360/24)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
cairo_stroke (cr)
end
-- ### END CLOCK A ########################################
local num=conky_parse("${fs_used_perc /home}")
local used=conky_parse("${fs_used /home}")
local size=conky_parse("${fs_size /home}")
-- ########################################################
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end-- end main function
draw-bg.lua
--[[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 ~/wea_conky/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 ~/wea_conky/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
# 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=40,y=40,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=" ",gh=40,gt=25,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 #########################################################
Last edited by fvirgola80 (2016-05-28 17:40:53)
Nothing happens by chance
Offline
Tanks ,
i have a question ...
Try with this
#!/bin/bash
wget -O $HOME/Desktop/loutch http://www.accuweather.com/fr/fr/sarreguemines/135050/weather-forecast/135050
sed -i '/<td><p>/!d' $HOME/Desktop/loutch
sed -i -e 's/^ *//' -e 's/<span>.*$//' -e 's/<td><p>//' $HOME/Desktop/loutch
char=$(cat $HOME/Desktop/loutch|wc -c)
if (( $char == 0 )); then
echo RAS > $HOME/Desktop/loutch
fi
The smartest I could come up with on a Saturday night
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
Theo YOU ARE THE BEST ,
I just change the directory from the script like this :
#!/bin/bash
wget -O $HOME/2b_Wunderground_API/Alertes http://www.accuweather.com/fr/fr/sarreguemines/135050/weather-forecast/135050
sed -i '/<td><p>/!d' $HOME/2b_Wunderground_API/Alertes
sed -i -e 's/^ *//' -e 's/<span>.*$//' -e 's/<td><p>//' $HOME/2b_Wunderground_API/Alertes
char=$(cat $HOME/2b_Wunderground_API/Alertes|wc -c)
if (( $char == 0 )); then
echo RAS > $HOME/2b_Wunderground_API/Alertes
fi
exit
and that done this that great :
Préparez-vous à un orage de forte intensité Lundi</p></td>
How can i cut the part after Lundi i try this
${alignc}${execi 600 sed -n '1p' $HOME/2b_Wunderground/Alertes | cut -c1-49}
that work great but that it is just for this specific line no?
@+
Last edited by loutch (2016-05-29 07:52:18)
Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX
Offline
Sorry Theo but after some minutes the script comes to start and now it make a Alertes with 4600 caracters like this
<!DOCTYPE html>
<html>
<head>
<title>Météo pour Sarreguemines - Prévision AccuWeather pour Moselle France (FR)</title>
<script type="text/javascript">window.NREUM||(NREUM={});NREUM.info = {"beacon":"bam.nr-data.net","errorBeacon":"bam.nr-data.net","licenseKey":"a690b21e9f","applicationID":"599479","transactionName":"NV0GYUFWCEUDBkNQDAwXKWNwGCBZEABUWBAWewtbR0UJWg4ARRY3CkoBUHdWHw==","queueTime":0,"applicationTime":535,"ttGuid":"E468FE27C0AA906C","agent":""}</script><script type="text/javascript">(window.NREUM||(NREUM={})).loader_config={xpid:"VQUFVl5UGwYJXVVVDg=="};window.NREUM||(NREUM={}),__nr_require=function(t,e,n){function r(n){if(!e[n]){var o=e[n]={exports:{}};t[n][0].call(o.exports,function(e){var o=t[n][1][e];return r(o||e)},o,o.exports)}return e[n].exports}if("function"==typeof __nr_require)return __nr_require;for(var o=0;o<n.length;o++)r(n[o]);return r}({1:[function(t,e,n){function r(t){try{s.console&&console.log(t)}catch(e){}}var o,i=t("ee"),a=t(14),s={};try{o=localStorage.getItem("__nr_flags").split(","),console&&"function"==typeof console.log&&(s.console=!0,-1!==o.indexOf("dev")&&(s.dev=!0),-1!==o.indexOf("nr_dev")&&(s.nrDev=!0))}catch(c){}s.nrDev&&i.on("internal-error",function(t){r(t.stack)}),s.dev&&i.on("fn-err",function(t,e,n){r(n.stack)}),s.dev&&(r("NR AGENT IN DEVELOPMENT MODE"),r("flags: "+a(s,function(t,e){return t}).join(", ")))},{}],2:[function(t,e,n){function r(t,e,n,r,o){try{d?d-=1:i("err",[o||new UncaughtException(t,e,n)])}catch(s){try{i("ierr",[s,(new Date).getTime(),!0])}catch(c){}}return"function"==typeof f?f.apply(this,a(arguments)):!1}function UncaughtException(t,e,n){this.message=t||"Uncaught error with no additional information",this.sourceURL=e,this.line=n}function o(t){i("err",[t,(new Date).getTime()])}var i=t("handle"),a=t(15),s=t("ee"),c=t("loader"),f=window.onerror,u=!1,d=0;c.features.err=!0,t(1),window.onerror=r;try{throw new Error}catch(l){"stack"in l&&(t(8),t(7),"addEventListener"in window&&t(5),c.xhrWrappable&&t(9),u=!0)}s.on("fn-start",function(t,e,n){u&&(d+=1)}),s.on("fn-err",function(t,e,n){u&&(this.thrown=!0,o(n))}),s.on("fn-end",function(){u&&!this.thrown&&d>0&&(d-=1)}),s.on("internal-error",function(t){i("ierr",[t,(new Date).getTime(),!0])})},{}],3:[function(t,e,n){t("loader").features.ins=!0},{}],4:[function(t,e,n){function r(t){}if(window.performance&&window.performance.timing&&window.performance.getEntriesByType){var o=t("ee"),i=t("handle"),a=t(8),s=t(7);t("loader").features.stn=!0,t(6);var c=NREUM.o.EV;o.on("fn-start",function(t,e){var n=t[0];n instanceof c&&(this.bstStart=Date.now())}),o.on("fn-end",function(t,e){var n=t[0];n instanceof c&&i("bst",[n,e,this.bstStart,Date.now()])}),a.on("fn-start",function(t,e,n){this.bstStart=Date.now(),this.bstType=n}),a.on("fn-end",function(t,e){i("bstTimer",[e,this.bstStart,Date.now(),this.bstType])}),s.on("fn-start",function(){this.bstStart=Date.now()}),s.on("fn-end",function(t,e){i("bstTimer",[e,this.bstStart,Date.now(),"requestAnimationFrame"])}),o.on("pushState-start",function(t){this.time=Date.now(),this.startPath=location.pathname+location.hash}),o.on("pushState-end",function(t){i("bstHist",[location.pathname+location.hash,this.startPath,this.time])}),"addEventListener"in window.performance&&(window.performance.clearResourceTimings?window.performance.addEventListener("resourcetimingbufferfull",function(t){i("bstResource",[window.performance.getEntriesByType("resource")]),window.performance.clearResourceTimings()},!1):window.performance.addEventListener("webkitresourcetimingbufferfull",function(t){i("bstResource",[window.performance.getEntriesByType("resource")]),window.performance.webkitClearResourceTimings()},!1)),document.addEventListener("scroll",r,!1),document.addEventListener("keypress",r,!1),document.addEventListener("click",r,!1)}},{}],5:[function(t,e,n){function r(t){for(var e=t;e&&!e.hasOwnProperty(u);)e=Object.getPrototypeOf(e);e&&o(e)}function o(t){s.inPlace(t,[u,d],"-",i)}function i(t,e){return t[1]}var a=t("ee").get("events"),s=t(16)(a),c=t("gos"),f=XMLHttpRequest,u="addEventListener",d="removeEventListener";e.exports=a,"getPrototypeOf"in Object?(r(document),r(window),r(f.prototype)):f.prototype.hasOwnProperty(u)&&(o(window),o(f.
prototype)),a.on(u+"-start",function(t,e){if(t[1]){var n=t[1];if("function"==typeof n){var r=c(n,"nr@wrapped",function(){return s(n,"fn-",null,n.name||"anonymous")});this.wrapped=t[1]=r}else"function"==typeof n.handleEvent&&s.inPlace(n,["handleEvent"],"fn-")}}),a.on(d+"-start",function(t){var e=this.wrapped;e&&(t[1]=e)})},{}],6:[function(t,e,n){var r=t("ee").get("history"),o=t(16)(r);e.exports=r,o.inPlace(window.history,["pushState","replaceState"],"-")},{}],7:[function(t,e,n){var r=t("ee").get("raf"),o=t(16)(r);e.exports=r,o.inPlace(window,["requestAnimationFrame","mozRequestAnimationFrame","webkitRequestAnimationFrame","msRequestAnimationFrame"],"raf-"),r.on("raf-start",function(t){t[0]=o(t[0],"fn-")})},{}],8:[function(t,e,n){function r(t,e,n){t[0]=a(t[0],"fn-",null,n)}function o(t,e,n){this.method=n,this.timerDuration="number"==typeof t[1]?t[1]:0,t[0]=a(t[0],"fn-",this,n)}var i=t("ee").get("timer"),a=t(16)(i);e.exports=i,a.inPlace(window,["setTimeout","setImmediate"],"setTimer-"),a.inPlace(window,["setInterval"],"setInterval-"),a.inPlace(window,["clearTimeout","clearImmediate"],"clearTimeout-"),i.on("setInterval-start",r),i.on("setTimer-start",o)},{}],9:[function(t,e,n){function r(t,e){d.inPlace(e,["onreadystatechange"],"fn-",s)}function o(){var t=this,e=u.context(t);t.readyState>3&&!e.resolved&&(e.resolved=!0,u.emit("xhr-resolved",[],t)),d.inPlace(t,v,"fn-",s)}function i(t){w.push(t),h&&(g=-g,b.data=g)}function a(){for(var t=0;t<w.length;t++)r([],w[t]);w.length&&(w=[])}function s(t,e){return e}function c(t,e){for(var n in t)e[n]=t[n];return e}t(5);var f=t("ee"),u=f.get("xhr"),d=t(16)(u),l=NREUM.o,p=l.XHR,h=l.MO,m="readystatechange",v=["onload","onerror","onabort","onloadstart","onloadend","onprogress","ontimeout"],w=[];e.exports=u;var y=window.XMLHttpRequest=function(t){var e=new p(t);try{u.emit("new-xhr",[e],e),e.addEventListener(m,o,!1)}catch(n){try{u.emit("internal-error",[n])}catch(r){}}return e};if(c(p,y),y.prototype=p.prototype,d.inPlace(y.prototype,["open","send"],"-xhr-",s),u.on("send-xhr-start",function(t,e){r(t,e),i(e)}),u.on("open-xhr-start",r),h){var g=1,b=document.createTextNode(g);new h(a).observe(b,{characterData:!0})}else f.on("fn-end",function(t){t[0]&&t[0].type===m||a()})},{}],10:[function(t,e,n){function r(t){var e=this.params,n=this.metrics;if(!this.ended){this.ended=!0;for(var r=0;l>r;r++)t.removeEventListener(d[r],this.listener,!1);if(!e.aborted){if(n.duration=(new Date).getTime()-this.startTime,4===t.readyState){e.status=t.status;var i=o(t,this.lastSize);if(i&&(n.rxSize=i),this.sameOrigin){var a=t.getResponseHeader("X-NewRelic-App-Data");a&&(e.cat=a.split(", ").pop())}}else e.status=0;n.cbTime=this.cbTime,u.emit("xhr-done",[t],t),c("xhr",[e,n,this.startTime])}}}function o(t,e){var n=t.responseType;if("json"===n&&null!==e)return e;var r="arraybuffer"===n||"blob"===n||"json"===n?t.response:t.responseText;return i(r)}function i(t){if("string"==typeof t&&t.length)return t.length;if("object"==typeof t){if("undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer&&t.byteLength)return t.byteLength;if("undefined"!=typeof Blob&&t instanceof Blob&&t.size)return t.size;if(!("undefined"!=typeof FormData&&t instanceof FormData))try{return JSON.stringify(t).length}catch(e){return}}}function a(t,e){var n=f(e),r=t.params;r.host=n.hostname+":"+n.port,r.pathname=n.pathname,t.sameOrigin=n.sameOrigin}var s=t("loader");if(s.xhrWrappable){var c=t("handle"),f=t(11),u=t("ee"),d=["load","error","abort","timeout"],l=d.length,p=t("id"),h=t(13),m=window.XMLHttpRequest;s.features.xhr=!0,t(9),u.on("new-xhr",function(t){var e=this;e.totalCbs=0,e.called=0,e.cbTime=0,e.end=r,e.ended=!1,e.xhrGuids={},e.lastSize=null,h&&(h>34||10>h)||window.opera||t.addEventListener("progress",function(t){e.lastSize=t.loaded},!1)}),u.on("open-xhr-start",function(t){this.params={method:t[0]},a(this,t[1]),this.metrics={}}),u.on("open-xhr-end",function(t,e){"loader_config"in NREUM&&"xpid"in NREUM.loader_config&&this.sameOrigin&&e.setRequestHeader("X-NewRelic-ID",NREUM.loader_config.xpid)}),u.on("send-xhr-start",function(t,e){var n=this.metrics,r=t[
0],o=this;if(n&&r){var a=i(r);a&&(n.txSize=a)}this.startTime=(new Date).getTime(),this.listener=function(t){try{"abort"===t.type&&(o.params.aborted=!0),("load"!==t.type||o.called===o.totalCbs&&(o.onloadCalled||"function"!=typeof e.onload))&&o.end(e)}catch(n){try{u.emit("internal-error",[n])}catch(r){}}};for(var s=0;l>s;s++)e.addEventListener(d[s],this.listener,!1)}),u.on("xhr-cb-time",function(t,e,n){this.cbTime+=t,e?this.onloadCalled=!0:this.called+=1,this.called!==this.totalCbs||!this.onloadCalled&&"function"==typeof n.onload||this.end(n)}),u.on("xhr-load-added",function(t,e){var n=""+p(t)+!!e;this.xhrGuids&&!this.xhrGuids[n]&&(this.xhrGuids[n]=!0,this.totalCbs+=1)}),u.on("xhr-load-removed",function(t,e){var n=""+p(t)+!!e;this.xhrGuids&&this.xhrGuids[n]&&(delete this.xhrGuids[n],this.totalCbs-=1)}),u.on("addEventListener-end",function(t,e){e instanceof m&&"load"===t[0]&&u.emit("xhr-load-added",[t[1],t[2]],e)}),u.on("removeEventListener-end",function(t,e){e instanceof m&&"load"===t[0]&&u.emit("xhr-load-removed",[t[1],t[2]],e)}),u.on("fn-start",function(t,e,n){e instanceof m&&("onload"===n&&(this.onload=!0),("load"===(t[0]&&t[0].type)||this.onload)&&(this.xhrCbStart=(new Date).getTime()))}),u.on("fn-end",function(t,e){this.xhrCbStart&&u.emit("xhr-cb-time",[(new Date).getTime()-this.xhrCbStart,this.onload,e],e)})}},{}],11:[function(t,e,n){e.exports=function(t){var e=document.createElement("a"),n=window.location,r={};e.href=t,r.port=e.port;var o=e.href.split("://");!r.port&&o[1]&&(r.port=o[1].split("/")[0].split("@").pop().split(":")[1]),r.port&&"0"!==r.port||(r.port="https"===o[0]?"443":"80"),r.hostname=e.hostname||n.hostname,r.pathname=e.pathname,r.protocol=o[0],"/"!==r.pathname.charAt(0)&&(r.pathname="/"+r.pathname);var i=!e.protocol||":"===e.protocol||e.protocol===n.protocol,a=e.hostname===document.domain&&e.port===n.port;return r.sameOrigin=i&&(!e.hostname||a),r}},{}],12:[function(t,e,n){function r(t,e){return function(){o(t,[(new Date).getTime()].concat(a(arguments)),null,e)}}var o=t("handle"),i=t(14),a=t(15);"undefined"==typeof window.newrelic&&(newrelic=NREUM);var s=["setPageViewName","setCustomAttribute","finished","addToTrace","inlineHit"],c=["addPageAction"],f="api-";i(s,function(t,e){newrelic[e]=r(f+e,"api")}),i(c,function(t,e){newrelic[e]=r(f+e)}),e.exports=newrelic,newrelic.noticeError=function(t){"string"==typeof t&&(t=new Error(t)),o("err",[t,(new Date).getTime()])}},{}],13:[function(t,e,n){var r=0,o=navigator.userAgent.match(/Firefox[\/\s](\d+\.\d+)/);o&&(r=+o[1]),e.exports=r},{}],14:[function(t,e,n){function r(t,e){var n=[],r="",i=0;for(r in t)o.call(t,r)&&(n[i]=e(r,t[r]),i+=1);return n}var o=Object.prototype.hasOwnProperty;e.exports=r},{}],15:[function(t,e,n){function r(t,e,n){e||(e=0),"undefined"==typeof n&&(n=t?t.length:0);for(var r=-1,o=n-e||0,i=Array(0>o?0:o);++r<o;)i[r]=t[e+r];return i}e.exports=r},{}],16:[function(t,e,n){function r(t){return!(t&&"function"==typeof t&&t.apply&&!t[a])}var o=t("ee"),i=t(15),a="nr@original",s=Object.prototype.hasOwnProperty,c=!1;e.exports=function(t){function e(t,e,n,o){function nrWrapper(){var r,a,s,c;try{a=this,r=i(arguments),s="function"==typeof n?n(r,a):n||{}}catch(u){d([u,"",[r,a,o],s])}f(e+"start",[r,a,o],s);try{return c=t.apply(a,r)}catch(l){throw f(e+"err",[r,a,l],s),l}finally{f(e+"end",[r,a,c],s)}}return r(t)?t:(e||(e=""),nrWrapper[a]=t,u(t,nrWrapper),nrWrapper)}function n(t,n,o,i){o||(o="");var a,s,c,f="-"===o.charAt(0);for(c=0;c<n.length;c++)s=n[c],a=t[s],r(a)||(t[s]=e(a,f?s+o:o,i,s))}function f(e,n,r){if(!c){c=!0;try{t.emit(e,n,r)}catch(o){d([o,e,n,r])}c=!1}}function u(t,e){if(Object.defineProperty&&Object.keys)try{var n=Object.keys(t);return n.forEach(function(n){Object.defineProperty(e,n,{get:function(){return t[n]},set:function(e){return t[n]=e,e}})}),e}catch(r){d([r])}for(var o in t)s.call(t,o)&&(e[o]=t[o]);return e}function d(e){try{t.emit("internal-error",e)}catch(n){}}return t||(t=o),e.inPlace=n,e.flag=a,e}},{}],ee:[function(t,e,n){function r(){}function o(t){function e(t){return t&&t instanceof r?t:t?s(t,a,i):i()}function n(n,r,o){t&&t(n,r,o);for(
var i=e(o),a=l(n),s=a.length,c=0;s>c;c++)a[c].apply(i,r);var u=f[v[n]];return u&&u.push([w,n,r,i]),i}function d(t,e){m[t]=l(t).concat(e)}function l(t){return m[t]||[]}function p(t){return u[t]=u[t]||o(n)}function h(t,e){c(t,function(t,n){e=e||"feature",v[n]=e,e in f||(f[e]=[])})}var m={},v={},w={on:d,emit:n,get:p,listeners:l,context:e,buffer:h};return w}function i(){return new r}var a="nr@context",s=t("gos"),c=t(14),f={},u={},d=e.exports=o();d.backlog=f},{}],gos:[function(t,e,n){function r(t,e,n){if(o.call(t,e))return t[e];var r=n();if(Object.defineProperty&&Object.keys)try{return Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!1}),r}catch(i){}return t[e]=r,r}var o=Object.prototype.hasOwnProperty;e.exports=r},{}],handle:[function(t,e,n){function r(t,e,n,r){o.buffer([t],r),o.emit(t,e,n)}var o=t("ee").get("handle");e.exports=r,r.ee=o},{}],id:[function(t,e,n){function r(t){var e=typeof t;return!t||"object"!==e&&"function"!==e?-1:t===window?0:a(t,i,function(){return o++})}var o=1,i="nr@id",a=t("gos");e.exports=r},{}],loader:[function(t,e,n){function r(){if(!m++){var t=h.info=NREUM.info,e=u.getElementsByTagName("script")[0];if(t&&t.licenseKey&&t.applicationID&&e){c(l,function(e,n){t[e]||(t[e]=n)});var n="https"===d.split(":")[0]||t.sslForHttp;h.proto=n?"https://":"http://",s("mark",["onload",a()],null,"api");var r=u.createElement("script");r.src=h.proto+t.agent,e.parentNode.insertBefore(r,e)}}}function o(){"complete"===u.readyState&&i()}function i(){s("mark",["domContent",a()],null,"api")}function a(){return(new Date).getTime()}var s=t("handle"),c=t(14),f=window,u=f.document;NREUM.o={ST:setTimeout,CT:clearTimeout,XHR:f.XMLHttpRequest,REQ:f.Request,EV:f.Event,PR:f.Promise,MO:f.MutationObserver},t(12);var d=""+location,l={beacon:"bam.nr-data.net",errorBeacon:"bam.nr-data.net",agent:"js-agent.newrelic.com/nr-943.min.js"},p=window.XMLHttpRequest&&XMLHttpRequest.prototype&&XMLHttpRequest.prototype.addEventListener&&!/CriOS/.test(navigator.userAgent),h=e.exports={offset:a(),origin:d,features:{},xhrWrappable:p};u.addEventListener?(u.addEventListener("DOMContentLoaded",i,!1),f.addEventListener("load",r,!1)):(u.attachEvent("onreadystatechange",o),f.attachEvent("onload",r)),s("mark",["firstbyte",a()],null,"api");var m=0},{}]},{},["loader",2,10,4,3]);</script>
<link rel="canonical" href="http://www.accuweather.com/fr/fr/sarreguemines/135050/weather-forecast/135050" />
<link rel="alternate" media="only screen and (max-width: 640px)" href="http://m.accuweather.com/fr/fr/sarreguemines/135050/weather-forecast/135050" />
<link rel="alternate" media="handheld" href="http://m.accuweather.com/fr/fr/sarreguemines/135050/weather-forecast/135050" />
<meta name="viewport" content="width=988"/>
<link rel="stylesheet" href="http://vortex.accuweather.com/adc2010/stylesheets/site.min-20160314.css" type="text/css" media="all" />
<style type="text/css">
@media print{#header-
& in conky i have this :
<!DOCTYPE html>
Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX
Offline
after a new refresh that is now ok , i try to change execi 600 to execi 1200 and look what that done .
Last edited by loutch (2016-05-29 09:04:49)
Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX
Offline
How can i cut the part after Lundi i try this...
Change your code to this
#!/bin/bash
wget -O $HOME/Desktop/loutch http://www.accuweather.com/fr/fr/sarreguemines/135050/weather-forecast/135050
sed -i '/<td><p>/!d' $HOME/Desktop/loutch
sed -i -e 's/^ *//' -e 's/<span>.*$//' -e 's/<td><p>//' -e 's/<\/p><\/td>.*$//' $HOME/Desktop/loutch
char=$(cat $HOME/Desktop/loutch|wc -c)
if (( $char == 0 )); then
echo RAS > $HOME/Desktop/loutch
fi
@fvirgola
Nice one mate!
Added the necessary links on the first page.
Last edited by TeoBigusGeekus (2016-05-29 10:39:46)
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
@Teo --> :8
Nothing happens by chance
Offline