SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#4301 2012-12-10 19:50:26

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

mrpeachy wrote:

^ thanks all smile

no 24 hour format yet, but should be easy to put in

however, i think its going to have to wait till ive recovered from this cold ive got sad

Oh my.  Hope you get well soon mrpeachy.

After being offline for three days I'm just getting back and I'm playing with one of Teo's scripts that shows weather for the next 16 hours.  Kinda neat.


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

Help fund CrunchBang, donate to the project!

#4302 2012-12-10 19:58:07

VastOne
#! Ranger
From: V-Ger
Registered: 2011-04-26
Posts: 10,165
Website

Re: Conky v1.9 Thread

mrpeachy wrote:

^ thanks all smile

no 24 hour format yet, but should be easy to put in

however, i think its going to have to wait till ive recovered from this cold ive got sad

I am hoping that you feel better soon mrpeachy...

Nice work on that lua with just a few minutes to spare!!! big_smile


VSIDO | Words That Build Or Destroy

I dev VSIDO

Offline

#4303 2012-12-10 20:38:32

McLovin
#! CrunchBanger
From: my computer chair
Registered: 2009-02-28
Posts: 105
Website

Re: Conky v1.9 Thread

ragamatrix wrote:

Hi;
I've found a way to display nasa archive "picture of the day" in a conky slide show, with a perl script modified and a resize convert one...I must clean things but it's working.Changing every minutes or more if you want.
Carrefull of your eyes:
nasa_slide_show

Where can we find the script? I think this could be modified to retrieve images from any site you want with the right modifications


8o Got /? | The first GUI, and "on-line" system was created in 1968 by Douglas Engelbart, the system included modern day innovations such as video conferencing, and on-line file sharing.

Offline

#4304 2012-12-10 20:39:41

McLovin
#! CrunchBanger
From: my computer chair
Registered: 2009-02-28
Posts: 105
Website

Re: Conky v1.9 Thread

@mrpeachy, I know how you feel, I've beem sick off and on for a while now lol, get better soon, I need that clock to start making new conky configs lol


8o Got /? | The first GUI, and "on-line" system was created in 1968 by Douglas Engelbart, the system included modern day innovations such as video conferencing, and on-line file sharing.

Offline

#4305 2012-12-10 20:57:35

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

McLovin wrote:

@mrpeachy, I know how you feel, I've beem sick off and on for a while now lol, get better soon, I need that clock to start making new conky configs lol

HEY!  Get your paws off my clock.  lol
I saw it second ... or third ... or fifth ... can we share?


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#4306 2012-12-10 21:05:49

DrakarNoir
#! CrunchBanger
From: just beyond the sign post
Registered: 2011-09-02
Posts: 132
Website

Re: Conky v1.9 Thread

Sector11 wrote:
McLovin wrote:

@mrpeachy, I know how you feel, I've beem sick off and on for a while now lol, get better soon, I need that clock to start making new conky configs lol

HEY!  Get your paws off my clock.  lol
I saw it second ... or third ... or fifth ... can we share?

oo...oo...oo...Me, too, me, too!!!   big_smile


"The nine most terrifying words in the English language are, 'I'm from the government and I'm here to help.'.”  ~Ronald Reagan

Offline

#4307 2012-12-10 21:06:49

McLovin
#! CrunchBanger
From: my computer chair
Registered: 2009-02-28
Posts: 105
Website

Re: Conky v1.9 Thread

Sector11 wrote:
McLovin wrote:

@mrpeachy, I know how you feel, I've beem sick off and on for a while now lol, get better soon, I need that clock to start making new conky configs lol

HEY!  Get your paws off my clock.  lol
I saw it second ... or third ... or fifth ... can we share?

I suppose we could share it, after all, you do the 24 hour thing, and I do the 12 hour thing, so I guess we can work on our own respective versions hmm


8o Got /? | The first GUI, and "on-line" system was created in 1968 by Douglas Engelbart, the system included modern day innovations such as video conferencing, and on-line file sharing.

Offline

#4308 2012-12-10 21:21:24

ansem_of_nexus
#! CrunchBanger
Registered: 2012-09-19
Posts: 234

Re: Conky v1.9 Thread

@sector11 I know what you mean, I prefer the 24 hour format myself. I am going to put one in the next lua I make, right now I need to finish the one I am making and get the media player out too.


You can find my work here

Make everything ok button

Offline

#4309 2012-12-10 21:42:47

ragamatrix
#! Junkie
From: Earth
Registered: 2012-12-05
Posts: 286

Re: Conky v1.9 Thread

McLovin wrote:
ragamatrix wrote:

Hi;
I've found a way to display nasa archive "picture of the day" in a conky slide show, with a perl script modified and a resize convert one...I must clean things but it's working.Changing every minutes or more if you want.
Carrefull of your eyes:
nasa_slide_show

Where can we find the script? I think this could be modified to retrieve images from any site you want with the right modifications

Here's what I did:

Script perl witch display nasa archive pictures in ~/wallpapers  random-nasa-wallpaper.pl:

#!/usr/bin/perl
# Copyright (c) Laszlo Simon.
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or ( at your option) any later version.
#             
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
#                            
# You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA)

# CONFIGURATION
##$explonation = 'true';        # true | false
##$explonation_place = 'south'; # east|north|west|south|norteast|...

# INIT
if (`xdpyinfo | grep dimensions` =~ /(\d+)x(\d+)\s+pixels/)
{
  ($width, $height) = ($1,$2);
}
else
{
  die("Can not determine screen resolution. Maybe 'xdpyinfo' not installed.\n");
}
  
$explonation_width = int($width * 2 / 3);
$explonation_height = int($width / 10);

$date = sprintf("%02d",0+int(rand(8)))
        .sprintf("%02d",1+int(rand(12)))
        .sprintf("%02d",1+int(rand(28)));

if (system("wget --version"))
{
  die("'wget' should be installed.\n")
}

system("wget -O /tmp/apxxxxxx.html 'http://antwrp.gsfc.nasa.gov/apod/ap$date.html'");

# Get image

open HTML, "/tmp/apxxxxxx.html";
$content = join('',(<HTML>));
close HTML;

$content =~ /\<a\s+href\=\"((?:\w+\/)*)(\w+)(\.\w+)\"\s*\>\s*\n*\s*\<img/ims;

$path = $1;
$img = $2;
$ext = $3;

`mkdir -p ~/wallpapers`;
print ">>>>http://antwrp.gsfc.nasa.gov/$path$img$ext\n";
system("wget -O ~/wallpapers/$img$ext 'http://antwrp.gsfc.nasa.gov/$path$img$ext'");

# Get text

#if (system("html2text -version"))
#{
#  warn("Explonation disabled. 'html2text' should be installed.\n");
#  $explonation = 'false';
#}

#if (system("convert -version"))
#{
#  warn("Explonation disabled. 'convert' (imagemagick) should be installed. \n");
#  $explonation = 'false';
#}


#if ($explonation eq 'true')
#{
#  system("html2text -style pretty -o /tmp/apxxxxxx.txt /tmp/apxxxxxx.html");
 
#  open TXT, "/tmp/apxxxxxx.txt";
#  $content = join('',(<TXT>));
#  close TXT;

#  $text = 
#    ($content =~ /Explanation:\s*(.*)\s*Tomorrow\'s picture:/s)
#    ? $1
#    : '';

#  print $text."\n";
  
#  $text =~ s/\n/ /g;

#  open TXT, ">/tmp/apxxxxxx-anno.txt";
#  print TXT $text;
#  close TXT;

#  system("convert ~/wallpapers/$img$ext "
#         ."-resize $width"."x$height\\> "
#         ."-size $width"."x$height xc:black +swap "
#         ."-gravity center "
#         ."-composite "
#         ."~/wallpapers/$img$ext"
#         );
         
#  system("convert "
#         ."-background '#0008' "
#         ."-fill white "
#         ."-gravity north "
#         ."-pointsize 20 "
#         ."-size $explonation_width"."x$explonation_height "
#         ."caption:\@/tmp/apxxxxxx-anno.txt "
#         ."~/wallpapers/$img$ext "
#          ."+swap -gravity $explonation_place -composite "
#         ."~/wallpapers/$img$ext"
#         );
#}

system("mv ~/wallpapers/$img$ext ~/wallpapers/image.jpg");

script convert  "random_nasa_pix.sh":

#!/bin/bash

convert ~/wallpapers/image.jpg  ~/wallpapers/image_random.png

convert ~/wallpapers/image_random.png -resize 640x360 ~/wallpapers/image_nasalight.png
##aqua effect
convert ~/wallpapers/image_nasalight.png -alpha off -fill white -colorize 100% \
     -draw 'fill black polygon 0,0 0,15 15,0 fill white circle 15,15 15,0' \
     \( +clone -flip \) -compose Multiply -composite \
     \( +clone -flop \) -compose Multiply -composite \
     -background gray60 -alpha Shape     ~/wallpapers/thumbnail_mask.png
###aqua effect2
convert ~/wallpapers/thumbnail_mask.png -bordercolor None -border 1x1 \
          -alpha Extract -blur 0x10  -shade 130x30 -alpha On \
          -background gray60 -alpha background -auto-level \
          -function polynomial  3.5,-5.05,2.05,0.3 \
          \( +clone -alpha extract  -blur 0x2 \) \
          -channel RGB -compose multiply -composite \
          +channel +compose -chop 1x1 \
          ~/wallpapers/thumbnail_lighting.png
##final
convert ~/wallpapers/image_nasalight.png -alpha Set ~/wallpapers/thumbnail_lighting.png \
          \( -clone 0,1 -alpha Opaque -compose Hardlight -composite \) \
          -delete 0 -compose In -composite \
          ~/wallpapers/image_nasa.png

#convert ~/wallpapers/image_nasa.png -resize 640x360 ~/wallpapers/image_nasalight.png

rm ~/wallpapers/thumbnail_lighting.png ;rm ~/wallpapers/thumbnail_mask.png ;rm ~/wallpapers/image_nasalight.png ;rm ~/wallpapers/image_random.png

conky:

background yes
update_interval 30
total_run_times 0

own_window yes
own_window_transparent yes
own_window_type override
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pagers
double_buffer yes
minimum_size 650 400#Taille minimum (px) ; largeur / hauteur
maximum_width 650  
alignment ml

gap_x 20
gap_y -80

imlib_cache_size 0
text_buffer_size 2048

TEXT

${execi 60 ~/développement/pgcrs-0.2.1/random-nasa-wallpaper.pl > /dev/null 2>&1}

${image ~/wallpapers/image_nasa.png -p 0,0 -n}

${execi 60 ~/.conky/script/random_nasa_pix.sh}

Offline

#4310 2012-12-10 23:14:12

ragamatrix
#! Junkie
From: Earth
Registered: 2012-12-05
Posts: 286

Re: Conky v1.9 Thread

one more weather chrono-clock that you can may be use with the v9000 script ? I've found a little thing to make blinking leds (soon Christmas )If you are interested in I'll post:
blinking_leds

Offline

#4311 2012-12-11 09:21:12

ragamatrix
#! Junkie
From: Earth
Registered: 2012-12-05
Posts: 286

Re: Conky v1.9 Thread

I'm trying the mayan calendar lua script of Mr Peachy but I got errors, can't how to fix it ?

└─> conky -c ~/développement/ConkyMayan
Conky: desktop window (ae) is root window
Conky: window type - override
Conky: drawing to created window (0x2200001)
Conky: drawing to double buffer
Conky: llua_do_call: function conky_draw_fig execution failed: /home/climatix/développement/mayan.lua:548: field 'year' missing in date table
Conky: llua_do_call: function conky_draw_fig execution failed: /home/climatix/développement/mayan.lua:548: field 'year' missing in date table
Conky: llua_do_call: function conky_draw_fig execution failed: /home/climatix/développement/mayan.lua:548: field 'year' missing in date table
Conky: llua_do_call: function conky_draw_fig execution failed: /home/climatix/développement/mayan.lua:548: field 'year' missing in date table
Conky: llua_do_call: function conky_draw_fig execution failed: /home/climatix/développement/mayan.lua:548: field 'year' missing in date table
Conky: llua_do_call: function conky_draw_fig execution failed: /home/climatix/développement/mayan.lua:548: field 'year' missing in date table
Conky: llua_do_call: function conky_draw_fig execution failed: /home/climatix/développement/mayan.lua:548: field 'year' missing in date table
Conky: llua_do_call: function conky_draw_fig execution failed: /home/climatix/développement/mayan.lua:548: field 'year' missing in date table
Conky: llua_do_call: function conky_draw_fig execution failed: /home/climatix/développement/mayan.lua:548: field 'yea

found there post#1544 :
mayancalendar Thanks for help

Offline

#4312 2012-12-11 21:15:37

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: Conky v1.9 Thread

^ that isnt the most recent version
ill see if i can find the code somewhere

but look at line 548 of mayan.lua and post what it says

Offline

#4313 2012-12-12 00:59:08

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Offline

#4314 2012-12-12 04:48:31

wolfeking
New Member
Registered: 2012-01-14
Posts: 3

Re: Conky v1.9 Thread

Forgive noobness, and sorry if this belongs in the conky thread, but I need some help sorting my coding. I got almost everything I wanted in there, but some of it is not working.

the coding I have done is

 
# conky configuration
#
# The list of variables has been removed from this file in favour
# of keeping the documentation more maintainable.
# Check http://conky.sf.net for an up-to-date-list.
#
# For ideas about how to modify conky, please see:
# http://crunchbanglinux.org/forums/topic/59/my-conky-config/
#
# For help with conky, please see:
# http://crunchbanglinux.org/forums/topic/2047/conky-help/
#
# Enjoy! :)
##############################################
#  Settings
##############################################
background yes
use_xft yes
xftfont sans:size=9
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_type desktop
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 200 200
maximum_width 240
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color d8d8d8
default_shade_color 000000
default_outline_color d9d7d6
alignment top_right
gap_x 12
gap_y 24
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale no
##############################################
#  Output
##############################################
TEXT
S Y S T E M    I N F O
${hr}
Host:$alignr$nodename
Uptime:$alignr$uptime
RAM:$alignr$mem/$memmax

HDD Temp:$alignr${hddtemp} *C
Swap usage:$alignr$swap/$swapmax
Disk usage:$alignr${fs_used /}/${fs_size /}

Charge:$alignr${battery_percent}%
Time:$alignr${battery_time}

CPU Speed:$alignr${freq_g} GHz
CPU Volt:$alignr${voltage_v} V
CPU usage:$alignr${cpu cpu0}%
CPU Temp:$alignr${acpitemp} *C

GPU Speed:$alignr${nvidia gpufreq} MHz 
GPU RAM:$alignr${nvidia memfreq} MHz
GPU Temp:$alignr${nvidia temp} *C

and it outputs the conky shown below.
2012-12-11--1355268516_1920x1200_scrot.png

well, as you can likely see, there are several N/A entries, and the CPU voltage is blank.  First step for me is getting help from y'all to get the relevant data into the N/A and blank spot. 

Also need help in finding a simple text output for conky that will show download speed, upload speed, downloaded data (in MB or GB), uploaded data, Wireless connection speed, and IP address.  I know I am asking for a lot there, but I judt don't know how to get that in a form that will go with the standard minimal display that I like.

Offline

#4315 2012-12-12 05:01:42

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: Conky v1.9 Thread

advice withdrawn.

Last edited by mrpeachy (2012-12-12 05:25:44)

Offline

#4316 2012-12-12 05:18:55

wolfeking
New Member
Registered: 2012-01-14
Posts: 3

Re: Conky v1.9 Thread

first off, the image is hosted on photobucket.  But w/e.

second, probably not going to post on the conky thread.  Tried that kind of thing elsewhere and it just gets lost, and people don't really try to help you fix yours, more try to get you to use theirs.  So sorry. I will just stop conky bootup before going through that again.

Last edited by wolfeking (2012-12-12 05:21:44)

Offline

#4317 2012-12-12 05:28:55

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: Conky v1.9 Thread

wolfeking wrote:

first off, the image is hosted on photobucket.  But w/e.

second, probably not going to post on the conky thread.  Tried that kind of thing elsewhere and it just gets lost, and people don't really try to help you fix yours, more try to get you to use theirs.  So sorry. I will just stop conky bootup before going through that again.

as you wish.

Offline

#4318 2012-12-12 09:58:33

dura
Bloated Gimp
From: interzone
Registered: 2012-09-15
Posts: 2,108

Re: Conky v1.9 Thread

Great attitude. People would be willing to help.

The reason you have N/A is because you need to configure conky to recognise your cpu's etc., Same with wlan, etc.,

I guess you don't want help anymore though.

Host your image file on ompldr or something because it is too big for the forum and does not help people with slow loading machines. Just a thumnail linking to a bigger picture elsewhere is needed.

Last edited by dura (2012-12-12 09:59:40)

Offline

#4319 2012-12-12 14:40:02

ragamatrix
#! Junkie
From: Earth
Registered: 2012-12-05
Posts: 286

Re: Conky v1.9 Thread

Thanks Mr Peachy,
I tried the new code that you posted I got no errors in terminal but on the screen I have that :
maya_screen
And the other script I've modified a little do display hours and dates in french but I've errors in terminal :

└─> conky -c ~/développement/ConkyMayan
Conky: desktop window (ae) is root window
Conky: window type - override
Conky: drawing to created window (0x2200001)
Conky: drawing to double buffer
Conky: '/home/climatix/développement/ConkyMayan' modified, reloading...
Conky: desktop window (ae) is root window
Conky: window type - override
Conky: drawing to created window (0x2200001)
Conky: drawing to double buffer
Conky: llua_do_call: function conky_draw_fig execution failed: /home/climatix/développement/mayan.lua:548: field 'year' missing in date table
Conky: llua_do_call: function conky_draw_fig execution failed: /home/climatix/développement/mayan.lua:548: field 'year' missing in date table
Conky: llua_do_call: function conky_draw_fig execution failed: /home/climatix/développement/mayan.lua:548: field 'year' missing in date table

The mayan.lua (french):

--yearclock by mrpeachy 2010
require 'cairo'

require 'cairo'
function addzero100(num)
if tonumber(num) < 10 then
return "00" .. num
elseif tonumber(num) <100 then
return "0" .. num
else
return num
end
end
function string:split(delimiter)
local result = { }
local from  = 1
local delim_from, delim_to = string.find( self, delimiter, from  )
while delim_from do
table.insert( result, string.sub( self, from , delim_from-1 ) )
from  = delim_to + 1
delim_from, delim_to = string.find( self, delimiter, from  )
end
table.insert( result, string.sub( self, from  ) )
return result
end
function circlewriting(cr, text, font, fsize, radi, horiz, verti, tred, tgreen, tblue, talpha, start, finish, var1)
local inum=string.len(text)
range=finish
deg=(finish-start)/(inum-1)
degrads=1*(math.pi/180)
local textcut=string.gsub(text, ".", "%1@@@")
texttable=string.split(textcut, "@@@")
for i = 1,inum do
ival=i
interval=(degrads*(start+(deg*(i-1))))+var1
interval2=degrads*(start+(deg*(i-1)))
txs=0+radi*(math.sin(interval))
tys=0-radi*(math.cos(interval))
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize);
cairo_set_source_rgba (cr, tred, tgreen, tblue, talpha);
cairo_move_to (cr, txs+horiz, tys+verti);
cairo_rotate (cr, interval2)
cairo_show_text (cr, (texttable[i]))
cairo_rotate (cr, -interval2)
cairo_move_to (cr,0,0)
cairo_set_source_rgba (cr, 0, 0, 0, 0)
cairo_line_to (cr,hx0,hy0)
cairo_stroke (cr)
end
end

function date_to_words()------------------------------------------------------------------------------------------
date=os.date("%d")
datecut=string.gsub(date, ".", "%1|")
datetable=string.split(datecut, "|")
        
        if datetable[1]=="1" then
            datetens=""
            datespacer=""
            if datetable[2]=="0" then
            dateunit="dix"
            elseif datetable[2]=="1" then
            dateunit="onze"
            elseif datetable[2]=="2" then
            dateunit="douze"
            elseif datetable[2]=="3" then
            dateunit="treize"
            elseif datetable[2]=="4" then
            dateunit="quatorze"
            elseif datetable[2]=="5" then
            dateunit="quinze"
            elseif datetable[2]=="6" then
            dateunit="seize"
            elseif datetable[2]=="7" then
            fisrtdigit="dixsept"
            elseif datetable[2]=="8" then
            dateunit="dixhuit"
            elseif datetable[2]=="9" then
            dateunit="dixneuf"
            end
        end 
          
        if datetable[1]=="0" or datetable[1]>"1" then
            datespacer=" "
            if datetable[1]=="2" then
            datetens="vingt"
            elseif datetable[1]=="3" then
            datetens="trente"
            elseif datetable[1]=="0" then
            datetens=""
            end 
            if datetable[2]=="1" then
            dateunit="premier"
            elseif datetable[2]=="2" then
            dateunit="deux"
            elseif datetable[2]=="3" then
            dateunit="trois"
            elseif datetable[2]=="4" then
            dateunit="quatre"
            elseif datetable[2]=="5" then
            dateunit="cinq"
            elseif datetable[2]=="6" then
            dateunit="six"
            elseif datetable[2]=="7" then
            dateunit="sept"
            elseif datetable[2]=="8" then
            dateunit="huit"
            elseif datetable[2]=="9" then
            dateunit="neuf"
            elseif datetable[2]=="0" then
            dateunit=""
            datespacer=""
            end
        end
        if datetable[2]=="0" then
            datetens=""
            datespacer=""
            if datetable[1]=="2" then
            dateunit="vingt"
            elseif datetable[1]=="3" then
            dateunit="trente"
            end
        end    
    return ((datetens) .. (datespacer) .. (dateunit))
end--end of function--------------------------------------------------------------------------------------

function number_to_words(text)
textlength=string.len(text)
textcut=string.gsub(text, ".", "%1|")
texttable=string.split(textcut, "|")
--for NUMBERS from 1 to 999
--for numbers 1 digit number----------
if textlength==1 then
    if texttable[1]=="1" then
    firstdigit="un"
    elseif texttable[1]=="2" then
    firstdigit="deux"
    elseif texttable[1]=="3" then
    firstdigit="trois"
    elseif texttable[1]=="4" then
    firstdigit="quatre"
    elseif texttable[1]=="5" then
    firstdigit="cinq"
    elseif texttable[1]=="6" then
    firstdigit="six"
    elseif texttable[1]=="7" then
    firstdigit="sept"
    elseif texttable[1]=="8" then
    firstdigit="huit"
    elseif texttable[1]=="9" then
    firstdigit="neuf"
    elseif texttable[1]=="0" then
    firstdigit="zero"
    end
return firstdigit
end
--for 2 digit number------------------
if textlength==2 then
    if texttable[1]=="1" then
        seconddigit=""
        spacer=""
        if texttable[2]=="0" then
        firstdigit="dix"
        elseif texttable[2]=="1" then
        firstdigit="onze"
        elseif texttable[2]=="2" then
        firstdigit="douze"
        elseif texttable[2]=="3" then
        firstdigit="treize"
        elseif texttable[2]=="4" then
        firstdigit="quatorze"
        elseif texttable[2]=="5" then
        firstdigit="quinze"
        elseif texttable[2]=="6" then
        firstdigit="seize"
        elseif texttable[2]=="7" then
        fisrtdigit="dixsept"
        elseif texttable[2]=="8" then
        firstdigit="dixhuit"
        elseif texttable[2]=="9" then
        firstdigit="dixneuf"
        end
    end   
    if texttable[1]>"1" then
        spacer=" "
        if texttable[1]=="2" then
        seconddigit="vingt"
        elseif texttable[1]=="3" then
        seconddigit="trente"
        elseif texttable[1]=="4" then
        seconddigit="quarante"
        elseif texttable[1]=="5" then
        seconddigit="cinquante"
        elseif texttable[1]=="6" then
        seconddigit="soixante"
        elseif texttable[1]=="7" then
        seconddigit="septente"
        elseif texttable[1]=="8" then
        seconddigit="quatrevingt"
        elseif texttable[1]=="9" then
        seconddigit="nonente"
        end    
        if texttable[2]=="1" then
        firstdigit="un"
        elseif texttable[2]=="2" then
        firstdigit="deux"
        elseif texttable[2]=="3" then
        firstdigit="trois"
        elseif texttable[2]=="4" then
        firstdigit="quatre"
        elseif texttable[2]=="5" then
        firstdigit="cinq"
        elseif texttable[2]=="6" then
        firstdigit="six"
        elseif texttable[2]=="7" then
        firstdigit="sept"
        elseif texttable[2]=="8" then
        firstdigit="huit"
        elseif texttable[2]=="9" then
        firstdigit="neuf"
        elseif texttable[2]=="0" then
        firstdigit=""
        spacer=""
        end
     end
return ((seconddigit) .. (spacer) .. (firstdigit))
end
--for 3 digit numbers-----------------------------
if textlength==3 then
    if texttable[2]=="0" and texttable[3]=="0" then space="" end
    if texttable[2]>"0" or texttable[3]>"0" then space=" and " end
    if texttable[2]=="0" and texttable[3]>"0" then spacer="" end
    
    if texttable[1]=="1" then
    thirddigit="cent"
    elseif texttable[1]=="2" then
    thirddigit="deux cent"
    elseif texttable[1]=="3" then
    thirddigit="trois cent"
    elseif texttable[1]=="4" then
    thirddigit="quatre cent"
    elseif texttable[1]=="5" then
    thirddigit="cinq cent"
    elseif texttable[1]=="6" then
    thirddigit="six cent"
    elseif texttable[1]=="7" then
    thirddigit="sept cent"
    elseif texttable[1]=="8" then
    thirddigit="huit cent"
    elseif texttable[1]=="9" then
    thirddigit="neuf cent"
    end
    if texttable[2]=="0" or texttable[2]>"1" then
        if texttable[3]=="1" then
        firstdigit="un"
        elseif texttable[3]=="2" then
        firstdigit="deux"
        elseif texttable[3]=="3" then
        firstdigit="trois"
        elseif texttable[3]=="4" then
        firstdigit="quatre"
        elseif texttable[3]=="5" then
        firstdigit="cinq"
        elseif texttable[3]=="6" then
        firstdigit="six"
        elseif texttable[3]=="7" then
        firstdigit="sept"
        elseif texttable[3]=="8" then
        firstdigit="huit"
        elseif texttable[3]=="9" then
        firstdigit="neuf"
        elseif texttable[3]=="0" then
        firstdigit=""
        spacer=""
        end 
    end
    if texttable[2]=="1" then
        seconddigit=""
        spacer=""  
        if texttable[3]=="0" then
        firstdigit="dix"
        elseif texttable[3]=="1" then
        firstdigit="onze"
        elseif texttable[3]=="2" then
        firstdigit="douze"
        elseif texttable[3]=="3" then
        firstdigit="treize"
        elseif texttable[3]=="4" then
        firstdigit="quatorze"
        elseif texttable[3]=="5" then
        firstdigit="quinze"
        elseif texttable[3]=="6" then
        firstdigit="seize"
        elseif texttable[3]=="7" then
        firstdigit="dixsept"
        elseif texttable[3]=="8" then
        firstdigit="dixhuit"
        elseif texttable[3]=="9" then
        firstdigit="dixneuf"
        end
    end
    if texttable[2] >"1" then
        spacer=" "    
        if texttable[2]=="2" then
        seconddigit="vingt"
        elseif texttable[2]=="3" then
        seconddigit="trente"
        elseif texttable[2]=="4" then
        seconddigit="quarante"
        elseif texttable[2]=="5" then
        seconddigit="cinquante"
        elseif texttable[2]=="6" then
        seconddigit="soixante"
        elseif texttable[2]=="7" then
        seconddigit="septente"
        elseif texttable[2]=="8" then
        seconddigit="quatrevingt"
        elseif texttable[2]=="9" then
        seconddigit="nonente"
        elseif texttable[2]=="0" then
        seconddigit=""
        end
    end
return ((thirddigit) .. (space) .. (seconddigit) .. (spacer) .. (firstdigit))
end
end--of function

function conky_draw_fig()
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 updates=tonumber(conky_parse('${updates}'))
if updates > 5 then

cairo_set_line_width (cr,1)
hx0=200
hy0=200
hrad1=80
hrad2=hrad1+10
br1,bg1,bb1,ba1=1,1,1,1
cairo_set_source_rgba (cr,br1,bg1,bb1,ba1)
cairo_arc (cr,hx0,hy0,hrad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,hrad2,0,2*math.pi)
cairo_stroke (cr)
for i=1,24 do
arc=((2*math.pi/360)*((360/24)*i))
hx1=0+hrad1*(math.sin(arc))
hy1=0-hrad1*(math.cos(arc))
arc=((2*math.pi/360)*((360/24)*i))
hx2=0+hrad2*(math.sin(arc))
hy2=0-hrad2*(math.cos(arc))
cairo_move_to (cr,hx0+hx1,hy0+hy1)
cairo_line_to (cr,hx0+hx2,hy0+hy2)
cairo_stroke (cr)
end
hr=os.date("%H")*60*60
mn=os.date("%M")*60
sc=os.date("%S")
hrs=hr+mn+sc
mns=mn+sc
hrad3=hrad2+10
arc=((2*math.pi/360)*((360/(24*60*60)*hrs)))
hx1=0+hrad2*(math.sin(arc))
hy1=0-hrad2*(math.cos(arc))
arc=(2*math.pi/360)*((360/(24*60*60))*(hrs)-4)
hx2=0+hrad3*(math.sin(arc))
hy2=0-hrad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/(24*60*60))*(hrs)+4)
hx3=0+hrad3*(math.sin(arc))
hy3=0-hrad3*(math.cos(arc))
cairo_move_to (cr,hx0+hx1,hy0+hy1)
cairo_line_to (cr,hx0+hx2,hy0+hy2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+hx1,hy0+hy1)
cairo_line_to (cr,hx0+hx3,hy0+hy3)
cairo_stroke (cr)

hrnum=os.date('%H')
if tonumber(os.date('%H'))<10 then hrnum=string.gsub(hrnum,"^.","") 
else hrnum=hrnum end
if hrnum==1 then hour="HEURE"
else hour="HEURES" end
text4=((string.upper(number_to_words(hrnum))) .. " " .. hour)
--text must be in quotes
text=text4
--font name must be in quotes
font="mono"
fontsize=10
radius=hrad2+1
positionx=hx0
positiony=hy0
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
--to set start and finish values for circlewriting, if the text will cross 0 degrees then you must calculate for 360+finish degrees
--eg if you want to go from 270 to 90, then you will input 270 to 450.  Finish has to be greater than start.
start=((360/(24*60*60))*(hrs)+4)
slen4=string.len(text)
finish=start+(slen4*5)
letterposition=0
circlewriting(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)

--minutes of hour
mrad1=hrad3
mrad2=mrad1+10
br1,bg1,bb1,ba1=1,1,1,1
cairo_set_source_rgba (cr,br1,bg1,bb1,ba1)
cairo_arc (cr,hx0,hy0,mrad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,mrad2,0,2*math.pi)
cairo_stroke (cr)
for i=1,60 do
arc=((2*math.pi/360)*((360/60)*i))
mx1=0+mrad1*(math.sin(arc))
my1=0-mrad1*(math.cos(arc))
arc=((2*math.pi/360)*((360/60)*i))
mx2=0+mrad2*(math.sin(arc))
my2=0-mrad2*(math.cos(arc))
cairo_move_to (cr,hx0+mx1,hy0+my1)
cairo_line_to (cr,hx0+mx2,hy0+my2)
cairo_stroke (cr)
end
mrad3=mrad2+10
arc=((2*math.pi/360)*((360/(60*60)*mns)))
mx1=0+mrad2*(math.sin(arc))
my1=0-mrad2*(math.cos(arc))
arc=(2*math.pi/360)*((360/(60*60))*(mns)-4)
mx2=0+mrad3*(math.sin(arc))
my2=0-mrad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/(60*60))*(mns)+4)
mx3=0+mrad3*(math.sin(arc))
my3=0-mrad3*(math.cos(arc))
cairo_move_to (cr,hx0+mx1,hy0+my1)
cairo_line_to (cr,hx0+mx2,hy0+my2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+mx1,hy0+my1)
cairo_line_to (cr,hx0+mx3,hy0+my3)
cairo_stroke (cr)

minnum=os.date('%M')
if tonumber(os.date('%M'))<10 then minnum=string.gsub(minnum,"^.","") 
else minnum=minnum end
if minnum==1 then minute="MINUTE"
else minute="MINUTES" end
text4=((string.upper(number_to_words(minnum))) .. " " .. minute)
--text must be in quotes
text=text4
--font name must be in quotes
font="mono"
fontsize=10
radius=mrad2+1
positionx=hx0
positiony=hy0
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
--to set start and finish values for circlewriting, if the text will cross 0 degrees then you must calculate for 360+finish degrees
--eg if you want to go from 270 to 90, then you will input 270 to 450.  Finish has to be greater than start.
start=((360/(60*60))*(mns)+4)
slen4=string.len(text)
finish=start+(slen4*5)
letterposition=0
circlewriting(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)

--seconds of minute
srad1=mrad3
srad2=srad1+10
br1,bg1,bb1,ba1=1,1,1,1
cairo_set_source_rgba (cr,br1,bg1,bb1,ba1)
cairo_arc (cr,hx0,hy0,srad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,srad2,0,2*math.pi)
cairo_stroke (cr)
for i=1,60 do
arc=((2*math.pi/360)*((360/60)*i))
sx1=0+srad1*(math.sin(arc))
sy1=0-srad1*(math.cos(arc))
arc=((2*math.pi/360)*((360/60)*i))
sx2=0+srad2*(math.sin(arc))
sy2=0-srad2*(math.cos(arc))
cairo_move_to (cr,hx0+sx1,hy0+sy1)
cairo_line_to (cr,hx0+sx2,hy0+sy2)
cairo_stroke (cr)
end
srad3=srad2+10
arc=((2*math.pi/360)*((360/(60)*sc)))
sx1=0+srad2*(math.sin(arc))
sy1=0-srad2*(math.cos(arc))
arc=(2*math.pi/360)*((360/60)*((sc))-4)
sx2=0+srad3*(math.sin(arc))
sy2=0-srad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/60)*((sc))+4)
sx3=0+srad3*(math.sin(arc))
sy3=0-srad3*(math.cos(arc))
cairo_move_to (cr,hx0+sx1,hy0+sy1)
cairo_line_to (cr,hx0+sx2,hy0+sy2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+sx1,hy0+sy1)
cairo_line_to (cr,hx0+sx3,hy0+sy3)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,srad3,0,2*math.pi)
cairo_stroke (cr)
--circlewriting
--circlewriting variable
secnum=os.date('%S')
if tonumber(os.date('%S'))<10 then secnum=string.gsub(secnum,"^.","") 
else secnum=secnum end
if secnum==1 then second="SECONDE"
else second="SECONDES" end
text3=((string.upper(number_to_words(secnum))) .. " " .. second)
--text must be in quotes
text=text3
--font name must be in quotes
font="mono"
fontsize=10
radius=srad2+1
positionx=hx0
positiony=hy0
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
--to set start and finish values for circlewriting, if the text will cross 0 degrees then you must calculate for 360+finish degrees
--eg if you want to go from 270 to 90, then you will input 270 to 450.  Finish has to be greater than start.
start=((360/60)*((sc))+4)
slen3=string.len(text)
finish=start+(slen3*5)
letterposition=0
circlewriting(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)

--months of the year
month=os.date("%m")
day=os.date("%d")
mnrad1=hrad1-40
mnrad2=mnrad1+10
br1,bg1,bb1,ba1=1,1,1,1
cairo_set_source_rgba (cr,br1,bg1,bb1,ba1)
cairo_arc (cr,hx0,hy0,mnrad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,mnrad2,0,2*math.pi)
cairo_stroke (cr)
--lines of months
year=os.date("%B")
t1 = os.time( {    year=year,month=03,day=01,hour=00,min=0,sec=0} );
t2 = os.time( {    year=year,month=02,day=01,hour=00,min=0,sec=0} );
feb=(os.difftime(t1,t2))/(24*60*60)
jan=31*24*60*60
feb=jan+(feb*24*60*60)
mar=feb+(31*24*60*60)
apr=mar+(30*24*60*60)
may=apr+(31*24*60*60)
jun=may+(30*24*60*60)
jul=jun+(31*24*60*60)
aug=jul+(31*24*60*60)
sep=aug+(30*24*60*60)
oct=sep+(31*24*60*60)
nov=oct+(30*24*60*60)
dec=nov+(31*24*60*60)
secdays = { jan, fev, mar, avr, mai, jui, jui, aou, sep, oct, nov, dec }
year=os.date("%B")
t1 = os.time( {    year=year,month=03,day=01,hour=00,min=0,sec=0} );
t2 = os.time( {    year=year,month=02,day=01,hour=00,min=0,sec=0} );
feb=(os.difftime(t1,t2))/(24*60*60)
yeardays=31+feb+31+30+31+30+31+31+30+31+30+31
yearsec=(yeardays*24*60*60)
for i=1,12 do
arc=((2*math.pi/360)*((360/yearsec)*(secdays[i])))
mnx1=0+mnrad1*(math.sin(arc))
mny1=0-mnrad1*(math.cos(arc))
arc=((2*math.pi/360)*((360/yearsec)*(secdays[i])))
mnx2=0+mnrad2*(math.sin(arc))
mny2=0-mnrad2*(math.cos(arc))
cairo_move_to (cr,hx0+mnx1,hy0+mny1)
cairo_line_to (cr,hx0+mnx2,hy0+mny2)
cairo_stroke (cr)
end
hr=os.date("%I")
doy=os.date("%j")
yrsecs=((doy-1)*24*60*60)+(sc)+(mn*60)+(hr*60*60)
mnrad3=mnrad2+10
arc=(2*math.pi/360)*((360/yearsec)*(yrsecs))
mnx1=0+mnrad2*(math.sin(arc))
mny1=0-mnrad2*(math.cos(arc))
arc=(2*math.pi/360)*((360/yearsec)*((yrsecs))+4)
mnx2=0+mnrad3*(math.sin(arc))
mny2=0-mnrad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/yearsec)*((yrsecs))-4)
mnx3=0+mnrad3*(math.sin(arc))
mny3=0-mnrad3*(math.cos(arc))
cairo_move_to (cr,hx0+mnx1,hy0+mny1)
cairo_line_to (cr,hx0+mnx2,hy0+mny2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+mnx1,hy0+mny1)
cairo_line_to (cr,hx0+mnx3,hy0+mny3)
cairo_stroke (cr)
--circlewriting
--circlewriting variable
text1=((string.upper(os.date('%B'))) .. " DEUX MILLE " .. string.upper(number_to_words(os.date('%y'))))
--text must be in quotes
text=text1
--font name must be in quotes
font="mono"
fontsize=10
radius=mnrad2+1
positionx=hx0
positiony=hy0
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
--to set start and finish values for circlewriting, if the text will cross 0 degrees then you must calculate for 360+finish degrees
--eg if you want to go from 270 to 90, then you will input 270 to 450.  Finish has to be greater than start.
start=((360/yearsec)*((yrsecs))+4)
slen2=string.len(text)
finish=start+270
letterposition=0
circlewriting(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)

--days of month
yrad1=mnrad3
yrad2=yrad1+10
br1,bg1,bb1,ba1=1,1,1,1
cairo_set_source_rgba (cr,br1,bg1,bb1,ba1)
cairo_arc (cr,hx0,hy0,yrad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,yrad2,0,2*math.pi)
cairo_stroke (cr)
monthdays = { 31, feb, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
for i=1,monthdays[tonumber(month)] do
arc=((2*math.pi/360)*((360/monthdays[tonumber(month)])*(i)))
yx1=0+yrad1*(math.sin(arc))
yy1=0-yrad1*(math.cos(arc))
arc=((2*math.pi/360)*((360/monthdays[tonumber(month)])*(i)))
yx2=0+yrad2*(math.sin(arc))
yy2=0-yrad2*(math.cos(arc))
cairo_move_to (cr,hx0+yx1,hy0+yy1)
cairo_line_to (cr,hx0+yx2,hy0+yy2)
cairo_stroke (cr)
end
yrad3=yrad2+10
arc=(2*math.pi/360)*((360/monthdays[tonumber(month)])*(day))
yx1=0+yrad2*(math.sin(arc))
yy1=0-yrad2*(math.cos(arc))
arc=(2*math.pi/360)*((360/monthdays[tonumber(month)])*((day))+4)
yx2=0+yrad3*(math.sin(arc))
yy2=0-yrad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/monthdays[tonumber(month)])*((day))-4)
yx3=0+yrad3*(math.sin(arc))
yy3=0-yrad3*(math.cos(arc))
cairo_move_to (cr,hx0+yx1,hy0+yy1)
cairo_line_to (cr,hx0+yx2,hy0+yy2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+yx1,hy0+yy1)
cairo_line_to (cr,hx0+yx3,hy0+yy3)
cairo_stroke (cr)
--circlewriting
--circlewriting variable
text1=((string.upper(os.date('%A'))) .. " LE " .. string.upper(date_to_words()))
--text must be in quotes
text=text1
--font name must be in quotes
font="mono"
fontsize=10
radius=yrad2+1
positionx=hx0
positiony=hy0
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
--to set start and finish values for circlewriting, if the text will cross 0 degrees then you must calculate for 360+finish degrees
--eg if you want to go from 270 to 90, then you will input 270 to 450.  Finish has to be greater than start.
start=((360/monthdays[tonumber(month)])*((day))+4)
slen1=string.len(text)
finish=start+(7.5*slen1)
letterposition=0
circlewriting(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)

--system monitor
--cpu
cairo_set_line_width (cr,1)
hx0=385
hy0=383
hrad1=40
hrad2=hrad1+10
br1,bg1,bb1,ba1=1,1,1,1

cairo_set_source_rgba (cr,br1,bg1,bb1,ba1)
cairo_arc (cr,hx0,hy0,hrad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,hrad2,0,2*math.pi)
cairo_stroke (cr)
for i=1,100 do
arc=(2*math.pi/100)*i
hx1=0+hrad1*(math.sin(arc))
hy1=0-hrad1*(math.cos(arc))
arc=(2*math.pi/100)*i
hx2=0+hrad2*(math.sin(arc))
hy2=0-hrad2*(math.cos(arc))
cairo_move_to (cr,hx0+hx1,hy0+hy1)
cairo_line_to (cr,hx0+hx2,hy0+hy2)
cairo_stroke (cr)
end
cpu=conky_parse('${cpu}')
hrad3=hrad2+10
arc=(2*math.pi/360)*((360/100)*((cpu)))
hx1=0+hrad2*(math.sin(arc))
hy1=0-hrad2*(math.cos(arc))
arc=(2*math.pi/360)*((360/100)*((cpu))+4)
hx2=0+hrad3*(math.sin(arc))
hy2=0-hrad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/100)*((cpu))-4)
hx3=0+hrad3*(math.sin(arc))
hy3=0-hrad3*(math.cos(arc))
cairo_move_to (cr,hx0+hx1,hy0+hy1)
cairo_line_to (cr,hx0+hx2,hy0+hy2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+hx1,hy0+hy1)
cairo_line_to (cr,hx0+hx3,hy0+hy3)
cairo_stroke (cr)
--memory
mrad1=hrad3
mrad2=mrad1+10
br1,bg1,bb1,ba1=1,1,1,1
cairo_set_source_rgba (cr,br1,bg1,bb1,ba1)
cairo_arc (cr,hx0,hy0,mrad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,mrad2,0,2*math.pi)
cairo_stroke (cr)
for i=1,100 do
arc=(2*math.pi/100)*i
mx1=0+mrad1*(math.sin(arc))
my1=0-mrad1*(math.cos(arc))
arc=(2*math.pi/100)*i
mx2=0+mrad2*(math.sin(arc))
my2=0-mrad2*(math.cos(arc))
cairo_move_to (cr,hx0+mx1,hy0+my1)
cairo_line_to (cr,hx0+mx2,hy0+my2)
cairo_stroke (cr)
end
mem=tonumber(conky_parse('${memperc}'))
mrad3=mrad2+10
arc=(2*math.pi/360)*((360/100)*((mem)))
mx1=0+mrad2*(math.sin(arc))
my1=0-mrad2*(math.cos(arc))
arc=(2*math.pi/360)*((360/100)*((mem))+4)
mx2=0+mrad3*(math.sin(arc))
my2=0-mrad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/100)*((mem))-4)
mx3=0+mrad3*(math.sin(arc))
my3=0-mrad3*(math.cos(arc))
cairo_move_to (cr,hx0+mx1,hy0+my1)
cairo_line_to (cr,hx0+mx2,hy0+my2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+mx1,hy0+my1)
cairo_line_to (cr,hx0+mx3,hy0+my3)
cairo_stroke (cr)
--fs_used root
srad1=mrad3
srad2=srad1+10
br1,bg1,bb1,ba1=1,1,1,1
cairo_set_source_rgba (cr,br1,bg1,bb1,ba1)
cairo_arc (cr,hx0,hy0,srad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,srad2,0,2*math.pi)
cairo_stroke (cr)
for i=1,100 do
arc=((2*math.pi/360)*((360/100)*i))
sx1=0+srad1*(math.sin(arc))
sy1=0-srad1*(math.cos(arc))
arc=((2*math.pi/360)*((360/100)*i))
sx2=0+srad2*(math.sin(arc))
sy2=0-srad2*(math.cos(arc))
cairo_move_to (cr,hx0+sx1,hy0+sy1)
cairo_line_to (cr,hx0+sx2,hy0+sy2)
cairo_stroke (cr)
end
fsr=conky_parse('${fs_used_perc /}')
srad3=srad2+10
arc=((2*math.pi/360)*((360/(100)*fsr)))
sx1=0+srad2*(math.sin(arc))
sy1=0-srad2*(math.cos(arc))
arc=(2*math.pi/360)*((360/100)*((fsr))-4)
sx2=0+srad3*(math.sin(arc))
sy2=0-srad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/100)*((fsr))+4)
sx3=0+srad3*(math.sin(arc))
sy3=0-srad3*(math.cos(arc))
cairo_move_to (cr,hx0+sx1,hy0+sy1)
cairo_line_to (cr,hx0+sx2,hy0+sy2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+sx1,hy0+sy1)
cairo_line_to (cr,hx0+sx3,hy0+sy3)
cairo_stroke (cr)
--fs used home
mnrad1=srad3
mnrad2=mnrad1+10
br1,bg1,bb1,ba1=1,1,1,1
cairo_set_source_rgba (cr,br1,bg1,bb1,ba1)
cairo_arc (cr,hx0,hy0,mnrad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,mnrad2,0,2*math.pi)
cairo_stroke (cr)
for i=1,100 do
arc=((2*math.pi/360)*((360/100)*i))
mnx1=0+mnrad1*(math.sin(arc))
mny1=0-mnrad1*(math.cos(arc))
arc=((2*math.pi/360)*((360/100)*i))
mnx2=0+mnrad2*(math.sin(arc))
mny2=0-mnrad2*(math.cos(arc))
cairo_move_to (cr,hx0+mnx1,hy0+mny1)
cairo_line_to (cr,hx0+mnx2,hy0+mny2)
cairo_stroke (cr)
end
fsh=conky_parse('${fs_used_perc /home}')
mnrad3=mnrad2+10
arc=((2*math.pi/360)*((360/(100)*fsh)))
mnx1=0+mnrad2*(math.sin(arc))
mny1=0-mnrad2*(math.cos(arc))
arc=(2*math.pi/360)*((360/100)*((fsh))-4)
mnx2=0+mnrad3*(math.sin(arc))
mny2=0-mnrad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/100)*((fsh))+4)
mnx3=0+mnrad3*(math.sin(arc))
mny3=0-mnrad3*(math.cos(arc))
cairo_move_to (cr,hx0+mnx1,hy0+mny1)
cairo_line_to (cr,hx0+mnx2,hy0+mny2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+mnx1,hy0+mny1)
cairo_line_to (cr,hx0+mnx3,hy0+mny3)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,mnrad3,0,2*math.pi)
cairo_stroke (cr)
end
end

maya_clock
Sorry if I did something ugly in your script...  roll

Last edited by ragamatrix (2012-12-12 14:41:50)

Offline

#4320 2012-12-12 15:15:19

ragamatrix
#! Junkie
From: Earth
Registered: 2012-12-05
Posts: 286

Re: Conky v1.9 Thread

ragamatrix wrote:

Thanks Mr Peachy,
I tried the new code that you posted I got no errors in terminal but on the screen I have that :
http://pix.toile-libre.org/upload/origi … 322369.png
And the other script I've modified a little do display hours and dates in french but I've errors in terminal :

└─> conky -c ~/développement/ConkyMayan
Conky: desktop window (ae) is root window
Conky: window type - override
Conky: drawing to created window (0x2200001)
Conky: drawing to double buffer
Conky: '/home/climatix/développement/ConkyMayan' modified, reloading...
Conky: desktop window (ae) is root window
Conky: window type - override
Conky: drawing to created window (0x2200001)
Conky: drawing to double buffer
Conky: llua_do_call: function conky_draw_fig execution failed: /home/climatix/développement/mayan.lua:548: field 'year' missing in date table
Conky: llua_do_call: function conky_draw_fig execution failed: /home/climatix/développement/mayan.lua:548: field 'year' missing in date table
Conky: llua_do_call: function conky_draw_fig execution failed: /home/climatix/développement/mayan.lua:548: field 'year' missing in date table

The mayan.lua (french):

--yearclock by mrpeachy 2010
require 'cairo'

require 'cairo'
function addzero100(num)
if tonumber(num) < 10 then
return "00" .. num
elseif tonumber(num) <100 then
return "0" .. num
else
return num
end
end
function string:split(delimiter)
local result = { }
local from  = 1
local delim_from, delim_to = string.find( self, delimiter, from  )
while delim_from do
table.insert( result, string.sub( self, from , delim_from-1 ) )
from  = delim_to + 1
delim_from, delim_to = string.find( self, delimiter, from  )
end
table.insert( result, string.sub( self, from  ) )
return result
end
function circlewriting(cr, text, font, fsize, radi, horiz, verti, tred, tgreen, tblue, talpha, start, finish, var1)
local inum=string.len(text)
range=finish
deg=(finish-start)/(inum-1)
degrads=1*(math.pi/180)
local textcut=string.gsub(text, ".", "%1@@@")
texttable=string.split(textcut, "@@@")
for i = 1,inum do
ival=i
interval=(degrads*(start+(deg*(i-1))))+var1
interval2=degrads*(start+(deg*(i-1)))
txs=0+radi*(math.sin(interval))
tys=0-radi*(math.cos(interval))
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize);
cairo_set_source_rgba (cr, tred, tgreen, tblue, talpha);
cairo_move_to (cr, txs+horiz, tys+verti);
cairo_rotate (cr, interval2)
cairo_show_text (cr, (texttable[i]))
cairo_rotate (cr, -interval2)
cairo_move_to (cr,0,0)
cairo_set_source_rgba (cr, 0, 0, 0, 0)
cairo_line_to (cr,hx0,hy0)
cairo_stroke (cr)
end
end

function date_to_words()------------------------------------------------------------------------------------------
date=os.date("%d")
datecut=string.gsub(date, ".", "%1|")
datetable=string.split(datecut, "|")
        
        if datetable[1]=="1" then
            datetens=""
            datespacer=""
            if datetable[2]=="0" then
            dateunit="dix"
            elseif datetable[2]=="1" then
            dateunit="onze"
            elseif datetable[2]=="2" then
            dateunit="douze"
            elseif datetable[2]=="3" then
            dateunit="treize"
            elseif datetable[2]=="4" then
            dateunit="quatorze"
            elseif datetable[2]=="5" then
            dateunit="quinze"
            elseif datetable[2]=="6" then
            dateunit="seize"
            elseif datetable[2]=="7" then
            fisrtdigit="dixsept"
            elseif datetable[2]=="8" then
            dateunit="dixhuit"
            elseif datetable[2]=="9" then
            dateunit="dixneuf"
            end
        end 
          
        if datetable[1]=="0" or datetable[1]>"1" then
            datespacer=" "
            if datetable[1]=="2" then
            datetens="vingt"
            elseif datetable[1]=="3" then
            datetens="trente"
            elseif datetable[1]=="0" then
            datetens=""
            end 
            if datetable[2]=="1" then
            dateunit="premier"
            elseif datetable[2]=="2" then
            dateunit="deux"
            elseif datetable[2]=="3" then
            dateunit="trois"
            elseif datetable[2]=="4" then
            dateunit="quatre"
            elseif datetable[2]=="5" then
            dateunit="cinq"
            elseif datetable[2]=="6" then
            dateunit="six"
            elseif datetable[2]=="7" then
            dateunit="sept"
            elseif datetable[2]=="8" then
            dateunit="huit"
            elseif datetable[2]=="9" then
            dateunit="neuf"
            elseif datetable[2]=="0" then
            dateunit=""
            datespacer=""
            end
        end
        if datetable[2]=="0" then
            datetens=""
            datespacer=""
            if datetable[1]=="2" then
            dateunit="vingt"
            elseif datetable[1]=="3" then
            dateunit="trente"
            end
        end    
    return ((datetens) .. (datespacer) .. (dateunit))
end--end of function--------------------------------------------------------------------------------------

function number_to_words(text)
textlength=string.len(text)
textcut=string.gsub(text, ".", "%1|")
texttable=string.split(textcut, "|")
--for NUMBERS from 1 to 999
--for numbers 1 digit number----------
if textlength==1 then
    if texttable[1]=="1" then
    firstdigit="un"
    elseif texttable[1]=="2" then
    firstdigit="deux"
    elseif texttable[1]=="3" then
    firstdigit="trois"
    elseif texttable[1]=="4" then
    firstdigit="quatre"
    elseif texttable[1]=="5" then
    firstdigit="cinq"
    elseif texttable[1]=="6" then
    firstdigit="six"
    elseif texttable[1]=="7" then
    firstdigit="sept"
    elseif texttable[1]=="8" then
    firstdigit="huit"
    elseif texttable[1]=="9" then
    firstdigit="neuf"
    elseif texttable[1]=="0" then
    firstdigit="zero"
    end
return firstdigit
end
--for 2 digit number------------------
if textlength==2 then
    if texttable[1]=="1" then
        seconddigit=""
        spacer=""
        if texttable[2]=="0" then
        firstdigit="dix"
        elseif texttable[2]=="1" then
        firstdigit="onze"
        elseif texttable[2]=="2" then
        firstdigit="douze"
        elseif texttable[2]=="3" then
        firstdigit="treize"
        elseif texttable[2]=="4" then
        firstdigit="quatorze"
        elseif texttable[2]=="5" then
        firstdigit="quinze"
        elseif texttable[2]=="6" then
        firstdigit="seize"
        elseif texttable[2]=="7" then
        fisrtdigit="dixsept"
        elseif texttable[2]=="8" then
        firstdigit="dixhuit"
        elseif texttable[2]=="9" then
        firstdigit="dixneuf"
        end
    end   
    if texttable[1]>"1" then
        spacer=" "
        if texttable[1]=="2" then
        seconddigit="vingt"
        elseif texttable[1]=="3" then
        seconddigit="trente"
        elseif texttable[1]=="4" then
        seconddigit="quarante"
        elseif texttable[1]=="5" then
        seconddigit="cinquante"
        elseif texttable[1]=="6" then
        seconddigit="soixante"
        elseif texttable[1]=="7" then
        seconddigit="septente"
        elseif texttable[1]=="8" then
        seconddigit="quatrevingt"
        elseif texttable[1]=="9" then
        seconddigit="nonente"
        end    
        if texttable[2]=="1" then
        firstdigit="un"
        elseif texttable[2]=="2" then
        firstdigit="deux"
        elseif texttable[2]=="3" then
        firstdigit="trois"
        elseif texttable[2]=="4" then
        firstdigit="quatre"
        elseif texttable[2]=="5" then
        firstdigit="cinq"
        elseif texttable[2]=="6" then
        firstdigit="six"
        elseif texttable[2]=="7" then
        firstdigit="sept"
        elseif texttable[2]=="8" then
        firstdigit="huit"
        elseif texttable[2]=="9" then
        firstdigit="neuf"
        elseif texttable[2]=="0" then
        firstdigit=""
        spacer=""
        end
     end
return ((seconddigit) .. (spacer) .. (firstdigit))
end
--for 3 digit numbers-----------------------------
if textlength==3 then
    if texttable[2]=="0" and texttable[3]=="0" then space="" end
    if texttable[2]>"0" or texttable[3]>"0" then space=" and " end
    if texttable[2]=="0" and texttable[3]>"0" then spacer="" end
    
    if texttable[1]=="1" then
    thirddigit="cent"
    elseif texttable[1]=="2" then
    thirddigit="deux cent"
    elseif texttable[1]=="3" then
    thirddigit="trois cent"
    elseif texttable[1]=="4" then
    thirddigit="quatre cent"
    elseif texttable[1]=="5" then
    thirddigit="cinq cent"
    elseif texttable[1]=="6" then
    thirddigit="six cent"
    elseif texttable[1]=="7" then
    thirddigit="sept cent"
    elseif texttable[1]=="8" then
    thirddigit="huit cent"
    elseif texttable[1]=="9" then
    thirddigit="neuf cent"
    end
    if texttable[2]=="0" or texttable[2]>"1" then
        if texttable[3]=="1" then
        firstdigit="un"
        elseif texttable[3]=="2" then
        firstdigit="deux"
        elseif texttable[3]=="3" then
        firstdigit="trois"
        elseif texttable[3]=="4" then
        firstdigit="quatre"
        elseif texttable[3]=="5" then
        firstdigit="cinq"
        elseif texttable[3]=="6" then
        firstdigit="six"
        elseif texttable[3]=="7" then
        firstdigit="sept"
        elseif texttable[3]=="8" then
        firstdigit="huit"
        elseif texttable[3]=="9" then
        firstdigit="neuf"
        elseif texttable[3]=="0" then
        firstdigit=""
        spacer=""
        end 
    end
    if texttable[2]=="1" then
        seconddigit=""
        spacer=""  
        if texttable[3]=="0" then
        firstdigit="dix"
        elseif texttable[3]=="1" then
        firstdigit="onze"
        elseif texttable[3]=="2" then
        firstdigit="douze"
        elseif texttable[3]=="3" then
        firstdigit="treize"
        elseif texttable[3]=="4" then
        firstdigit="quatorze"
        elseif texttable[3]=="5" then
        firstdigit="quinze"
        elseif texttable[3]=="6" then
        firstdigit="seize"
        elseif texttable[3]=="7" then
        firstdigit="dixsept"
        elseif texttable[3]=="8" then
        firstdigit="dixhuit"
        elseif texttable[3]=="9" then
        firstdigit="dixneuf"
        end
    end
    if texttable[2] >"1" then
        spacer=" "    
        if texttable[2]=="2" then
        seconddigit="vingt"
        elseif texttable[2]=="3" then
        seconddigit="trente"
        elseif texttable[2]=="4" then
        seconddigit="quarante"
        elseif texttable[2]=="5" then
        seconddigit="cinquante"
        elseif texttable[2]=="6" then
        seconddigit="soixante"
        elseif texttable[2]=="7" then
        seconddigit="septente"
        elseif texttable[2]=="8" then
        seconddigit="quatrevingt"
        elseif texttable[2]=="9" then
        seconddigit="nonente"
        elseif texttable[2]=="0" then
        seconddigit=""
        end
    end
return ((thirddigit) .. (space) .. (seconddigit) .. (spacer) .. (firstdigit))
end
end--of function

function conky_draw_fig()
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 updates=tonumber(conky_parse('${updates}'))
if updates > 5 then

cairo_set_line_width (cr,1)
hx0=200
hy0=200
hrad1=80
hrad2=hrad1+10
br1,bg1,bb1,ba1=1,1,1,1
cairo_set_source_rgba (cr,br1,bg1,bb1,ba1)
cairo_arc (cr,hx0,hy0,hrad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,hrad2,0,2*math.pi)
cairo_stroke (cr)
for i=1,24 do
arc=((2*math.pi/360)*((360/24)*i))
hx1=0+hrad1*(math.sin(arc))
hy1=0-hrad1*(math.cos(arc))
arc=((2*math.pi/360)*((360/24)*i))
hx2=0+hrad2*(math.sin(arc))
hy2=0-hrad2*(math.cos(arc))
cairo_move_to (cr,hx0+hx1,hy0+hy1)
cairo_line_to (cr,hx0+hx2,hy0+hy2)
cairo_stroke (cr)
end
hr=os.date("%H")*60*60
mn=os.date("%M")*60
sc=os.date("%S")
hrs=hr+mn+sc
mns=mn+sc
hrad3=hrad2+10
arc=((2*math.pi/360)*((360/(24*60*60)*hrs)))
hx1=0+hrad2*(math.sin(arc))
hy1=0-hrad2*(math.cos(arc))
arc=(2*math.pi/360)*((360/(24*60*60))*(hrs)-4)
hx2=0+hrad3*(math.sin(arc))
hy2=0-hrad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/(24*60*60))*(hrs)+4)
hx3=0+hrad3*(math.sin(arc))
hy3=0-hrad3*(math.cos(arc))
cairo_move_to (cr,hx0+hx1,hy0+hy1)
cairo_line_to (cr,hx0+hx2,hy0+hy2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+hx1,hy0+hy1)
cairo_line_to (cr,hx0+hx3,hy0+hy3)
cairo_stroke (cr)

hrnum=os.date('%H')
if tonumber(os.date('%H'))<10 then hrnum=string.gsub(hrnum,"^.","") 
else hrnum=hrnum end
if hrnum==1 then hour="HEURE"
else hour="HEURES" end
text4=((string.upper(number_to_words(hrnum))) .. " " .. hour)
--text must be in quotes
text=text4
--font name must be in quotes
font="mono"
fontsize=10
radius=hrad2+1
positionx=hx0
positiony=hy0
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
--to set start and finish values for circlewriting, if the text will cross 0 degrees then you must calculate for 360+finish degrees
--eg if you want to go from 270 to 90, then you will input 270 to 450.  Finish has to be greater than start.
start=((360/(24*60*60))*(hrs)+4)
slen4=string.len(text)
finish=start+(slen4*5)
letterposition=0
circlewriting(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)

--minutes of hour
mrad1=hrad3
mrad2=mrad1+10
br1,bg1,bb1,ba1=1,1,1,1
cairo_set_source_rgba (cr,br1,bg1,bb1,ba1)
cairo_arc (cr,hx0,hy0,mrad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,mrad2,0,2*math.pi)
cairo_stroke (cr)
for i=1,60 do
arc=((2*math.pi/360)*((360/60)*i))
mx1=0+mrad1*(math.sin(arc))
my1=0-mrad1*(math.cos(arc))
arc=((2*math.pi/360)*((360/60)*i))
mx2=0+mrad2*(math.sin(arc))
my2=0-mrad2*(math.cos(arc))
cairo_move_to (cr,hx0+mx1,hy0+my1)
cairo_line_to (cr,hx0+mx2,hy0+my2)
cairo_stroke (cr)
end
mrad3=mrad2+10
arc=((2*math.pi/360)*((360/(60*60)*mns)))
mx1=0+mrad2*(math.sin(arc))
my1=0-mrad2*(math.cos(arc))
arc=(2*math.pi/360)*((360/(60*60))*(mns)-4)
mx2=0+mrad3*(math.sin(arc))
my2=0-mrad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/(60*60))*(mns)+4)
mx3=0+mrad3*(math.sin(arc))
my3=0-mrad3*(math.cos(arc))
cairo_move_to (cr,hx0+mx1,hy0+my1)
cairo_line_to (cr,hx0+mx2,hy0+my2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+mx1,hy0+my1)
cairo_line_to (cr,hx0+mx3,hy0+my3)
cairo_stroke (cr)

minnum=os.date('%M')
if tonumber(os.date('%M'))<10 then minnum=string.gsub(minnum,"^.","") 
else minnum=minnum end
if minnum==1 then minute="MINUTE"
else minute="MINUTES" end
text4=((string.upper(number_to_words(minnum))) .. " " .. minute)
--text must be in quotes
text=text4
--font name must be in quotes
font="mono"
fontsize=10
radius=mrad2+1
positionx=hx0
positiony=hy0
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
--to set start and finish values for circlewriting, if the text will cross 0 degrees then you must calculate for 360+finish degrees
--eg if you want to go from 270 to 90, then you will input 270 to 450.  Finish has to be greater than start.
start=((360/(60*60))*(mns)+4)
slen4=string.len(text)
finish=start+(slen4*5)
letterposition=0
circlewriting(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)

--seconds of minute
srad1=mrad3
srad2=srad1+10
br1,bg1,bb1,ba1=1,1,1,1
cairo_set_source_rgba (cr,br1,bg1,bb1,ba1)
cairo_arc (cr,hx0,hy0,srad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,srad2,0,2*math.pi)
cairo_stroke (cr)
for i=1,60 do
arc=((2*math.pi/360)*((360/60)*i))
sx1=0+srad1*(math.sin(arc))
sy1=0-srad1*(math.cos(arc))
arc=((2*math.pi/360)*((360/60)*i))
sx2=0+srad2*(math.sin(arc))
sy2=0-srad2*(math.cos(arc))
cairo_move_to (cr,hx0+sx1,hy0+sy1)
cairo_line_to (cr,hx0+sx2,hy0+sy2)
cairo_stroke (cr)
end
srad3=srad2+10
arc=((2*math.pi/360)*((360/(60)*sc)))
sx1=0+srad2*(math.sin(arc))
sy1=0-srad2*(math.cos(arc))
arc=(2*math.pi/360)*((360/60)*((sc))-4)
sx2=0+srad3*(math.sin(arc))
sy2=0-srad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/60)*((sc))+4)
sx3=0+srad3*(math.sin(arc))
sy3=0-srad3*(math.cos(arc))
cairo_move_to (cr,hx0+sx1,hy0+sy1)
cairo_line_to (cr,hx0+sx2,hy0+sy2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+sx1,hy0+sy1)
cairo_line_to (cr,hx0+sx3,hy0+sy3)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,srad3,0,2*math.pi)
cairo_stroke (cr)
--circlewriting
--circlewriting variable
secnum=os.date('%S')
if tonumber(os.date('%S'))<10 then secnum=string.gsub(secnum,"^.","") 
else secnum=secnum end
if secnum==1 then second="SECONDE"
else second="SECONDES" end
text3=((string.upper(number_to_words(secnum))) .. " " .. second)
--text must be in quotes
text=text3
--font name must be in quotes
font="mono"
fontsize=10
radius=srad2+1
positionx=hx0
positiony=hy0
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
--to set start and finish values for circlewriting, if the text will cross 0 degrees then you must calculate for 360+finish degrees
--eg if you want to go from 270 to 90, then you will input 270 to 450.  Finish has to be greater than start.
start=((360/60)*((sc))+4)
slen3=string.len(text)
finish=start+(slen3*5)
letterposition=0
circlewriting(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)

--months of the year
month=os.date("%m")
day=os.date("%d")
mnrad1=hrad1-40
mnrad2=mnrad1+10
br1,bg1,bb1,ba1=1,1,1,1
cairo_set_source_rgba (cr,br1,bg1,bb1,ba1)
cairo_arc (cr,hx0,hy0,mnrad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,mnrad2,0,2*math.pi)
cairo_stroke (cr)
--lines of months
year=os.date("%B")
t1 = os.time( {    year=year,month=03,day=01,hour=00,min=0,sec=0} );
t2 = os.time( {    year=year,month=02,day=01,hour=00,min=0,sec=0} );
feb=(os.difftime(t1,t2))/(24*60*60)
jan=31*24*60*60
feb=jan+(feb*24*60*60)
mar=feb+(31*24*60*60)
apr=mar+(30*24*60*60)
may=apr+(31*24*60*60)
jun=may+(30*24*60*60)
jul=jun+(31*24*60*60)
aug=jul+(31*24*60*60)
sep=aug+(30*24*60*60)
oct=sep+(31*24*60*60)
nov=oct+(30*24*60*60)
dec=nov+(31*24*60*60)
secdays = { jan, fev, mar, avr, mai, jui, jui, aou, sep, oct, nov, dec }
year=os.date("%B")
t1 = os.time( {    year=year,month=03,day=01,hour=00,min=0,sec=0} );
t2 = os.time( {    year=year,month=02,day=01,hour=00,min=0,sec=0} );
feb=(os.difftime(t1,t2))/(24*60*60)
yeardays=31+feb+31+30+31+30+31+31+30+31+30+31
yearsec=(yeardays*24*60*60)
for i=1,12 do
arc=((2*math.pi/360)*((360/yearsec)*(secdays[i])))
mnx1=0+mnrad1*(math.sin(arc))
mny1=0-mnrad1*(math.cos(arc))
arc=((2*math.pi/360)*((360/yearsec)*(secdays[i])))
mnx2=0+mnrad2*(math.sin(arc))
mny2=0-mnrad2*(math.cos(arc))
cairo_move_to (cr,hx0+mnx1,hy0+mny1)
cairo_line_to (cr,hx0+mnx2,hy0+mny2)
cairo_stroke (cr)
end
hr=os.date("%I")
doy=os.date("%j")
yrsecs=((doy-1)*24*60*60)+(sc)+(mn*60)+(hr*60*60)
mnrad3=mnrad2+10
arc=(2*math.pi/360)*((360/yearsec)*(yrsecs))
mnx1=0+mnrad2*(math.sin(arc))
mny1=0-mnrad2*(math.cos(arc))
arc=(2*math.pi/360)*((360/yearsec)*((yrsecs))+4)
mnx2=0+mnrad3*(math.sin(arc))
mny2=0-mnrad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/yearsec)*((yrsecs))-4)
mnx3=0+mnrad3*(math.sin(arc))
mny3=0-mnrad3*(math.cos(arc))
cairo_move_to (cr,hx0+mnx1,hy0+mny1)
cairo_line_to (cr,hx0+mnx2,hy0+mny2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+mnx1,hy0+mny1)
cairo_line_to (cr,hx0+mnx3,hy0+mny3)
cairo_stroke (cr)
--circlewriting
--circlewriting variable
text1=((string.upper(os.date('%B'))) .. " DEUX MILLE " .. string.upper(number_to_words(os.date('%y'))))
--text must be in quotes
text=text1
--font name must be in quotes
font="mono"
fontsize=10
radius=mnrad2+1
positionx=hx0
positiony=hy0
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
--to set start and finish values for circlewriting, if the text will cross 0 degrees then you must calculate for 360+finish degrees
--eg if you want to go from 270 to 90, then you will input 270 to 450.  Finish has to be greater than start.
start=((360/yearsec)*((yrsecs))+4)
slen2=string.len(text)
finish=start+270
letterposition=0
circlewriting(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)

--days of month
yrad1=mnrad3
yrad2=yrad1+10
br1,bg1,bb1,ba1=1,1,1,1
cairo_set_source_rgba (cr,br1,bg1,bb1,ba1)
cairo_arc (cr,hx0,hy0,yrad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,yrad2,0,2*math.pi)
cairo_stroke (cr)
monthdays = { 31, feb, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
for i=1,monthdays[tonumber(month)] do
arc=((2*math.pi/360)*((360/monthdays[tonumber(month)])*(i)))
yx1=0+yrad1*(math.sin(arc))
yy1=0-yrad1*(math.cos(arc))
arc=((2*math.pi/360)*((360/monthdays[tonumber(month)])*(i)))
yx2=0+yrad2*(math.sin(arc))
yy2=0-yrad2*(math.cos(arc))
cairo_move_to (cr,hx0+yx1,hy0+yy1)
cairo_line_to (cr,hx0+yx2,hy0+yy2)
cairo_stroke (cr)
end
yrad3=yrad2+10
arc=(2*math.pi/360)*((360/monthdays[tonumber(month)])*(day))
yx1=0+yrad2*(math.sin(arc))
yy1=0-yrad2*(math.cos(arc))
arc=(2*math.pi/360)*((360/monthdays[tonumber(month)])*((day))+4)
yx2=0+yrad3*(math.sin(arc))
yy2=0-yrad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/monthdays[tonumber(month)])*((day))-4)
yx3=0+yrad3*(math.sin(arc))
yy3=0-yrad3*(math.cos(arc))
cairo_move_to (cr,hx0+yx1,hy0+yy1)
cairo_line_to (cr,hx0+yx2,hy0+yy2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+yx1,hy0+yy1)
cairo_line_to (cr,hx0+yx3,hy0+yy3)
cairo_stroke (cr)
--circlewriting
--circlewriting variable
text1=((string.upper(os.date('%A'))) .. " LE " .. string.upper(date_to_words()))
--text must be in quotes
text=text1
--font name must be in quotes
font="mono"
fontsize=10
radius=yrad2+1
positionx=hx0
positiony=hy0
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
--to set start and finish values for circlewriting, if the text will cross 0 degrees then you must calculate for 360+finish degrees
--eg if you want to go from 270 to 90, then you will input 270 to 450.  Finish has to be greater than start.
start=((360/monthdays[tonumber(month)])*((day))+4)
slen1=string.len(text)
finish=start+(7.5*slen1)
letterposition=0
circlewriting(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)

--system monitor
--cpu
cairo_set_line_width (cr,1)
hx0=385
hy0=383
hrad1=40
hrad2=hrad1+10
br1,bg1,bb1,ba1=1,1,1,1

cairo_set_source_rgba (cr,br1,bg1,bb1,ba1)
cairo_arc (cr,hx0,hy0,hrad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,hrad2,0,2*math.pi)
cairo_stroke (cr)
for i=1,100 do
arc=(2*math.pi/100)*i
hx1=0+hrad1*(math.sin(arc))
hy1=0-hrad1*(math.cos(arc))
arc=(2*math.pi/100)*i
hx2=0+hrad2*(math.sin(arc))
hy2=0-hrad2*(math.cos(arc))
cairo_move_to (cr,hx0+hx1,hy0+hy1)
cairo_line_to (cr,hx0+hx2,hy0+hy2)
cairo_stroke (cr)
end
cpu=conky_parse('${cpu}')
hrad3=hrad2+10
arc=(2*math.pi/360)*((360/100)*((cpu)))
hx1=0+hrad2*(math.sin(arc))
hy1=0-hrad2*(math.cos(arc))
arc=(2*math.pi/360)*((360/100)*((cpu))+4)
hx2=0+hrad3*(math.sin(arc))
hy2=0-hrad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/100)*((cpu))-4)
hx3=0+hrad3*(math.sin(arc))
hy3=0-hrad3*(math.cos(arc))
cairo_move_to (cr,hx0+hx1,hy0+hy1)
cairo_line_to (cr,hx0+hx2,hy0+hy2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+hx1,hy0+hy1)
cairo_line_to (cr,hx0+hx3,hy0+hy3)
cairo_stroke (cr)
--memory
mrad1=hrad3
mrad2=mrad1+10
br1,bg1,bb1,ba1=1,1,1,1
cairo_set_source_rgba (cr,br1,bg1,bb1,ba1)
cairo_arc (cr,hx0,hy0,mrad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,mrad2,0,2*math.pi)
cairo_stroke (cr)
for i=1,100 do
arc=(2*math.pi/100)*i
mx1=0+mrad1*(math.sin(arc))
my1=0-mrad1*(math.cos(arc))
arc=(2*math.pi/100)*i
mx2=0+mrad2*(math.sin(arc))
my2=0-mrad2*(math.cos(arc))
cairo_move_to (cr,hx0+mx1,hy0+my1)
cairo_line_to (cr,hx0+mx2,hy0+my2)
cairo_stroke (cr)
end
mem=tonumber(conky_parse('${memperc}'))
mrad3=mrad2+10
arc=(2*math.pi/360)*((360/100)*((mem)))
mx1=0+mrad2*(math.sin(arc))
my1=0-mrad2*(math.cos(arc))
arc=(2*math.pi/360)*((360/100)*((mem))+4)
mx2=0+mrad3*(math.sin(arc))
my2=0-mrad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/100)*((mem))-4)
mx3=0+mrad3*(math.sin(arc))
my3=0-mrad3*(math.cos(arc))
cairo_move_to (cr,hx0+mx1,hy0+my1)
cairo_line_to (cr,hx0+mx2,hy0+my2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+mx1,hy0+my1)
cairo_line_to (cr,hx0+mx3,hy0+my3)
cairo_stroke (cr)
--fs_used root
srad1=mrad3
srad2=srad1+10
br1,bg1,bb1,ba1=1,1,1,1
cairo_set_source_rgba (cr,br1,bg1,bb1,ba1)
cairo_arc (cr,hx0,hy0,srad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,srad2,0,2*math.pi)
cairo_stroke (cr)
for i=1,100 do
arc=((2*math.pi/360)*((360/100)*i))
sx1=0+srad1*(math.sin(arc))
sy1=0-srad1*(math.cos(arc))
arc=((2*math.pi/360)*((360/100)*i))
sx2=0+srad2*(math.sin(arc))
sy2=0-srad2*(math.cos(arc))
cairo_move_to (cr,hx0+sx1,hy0+sy1)
cairo_line_to (cr,hx0+sx2,hy0+sy2)
cairo_stroke (cr)
end
fsr=conky_parse('${fs_used_perc /}')
srad3=srad2+10
arc=((2*math.pi/360)*((360/(100)*fsr)))
sx1=0+srad2*(math.sin(arc))
sy1=0-srad2*(math.cos(arc))
arc=(2*math.pi/360)*((360/100)*((fsr))-4)
sx2=0+srad3*(math.sin(arc))
sy2=0-srad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/100)*((fsr))+4)
sx3=0+srad3*(math.sin(arc))
sy3=0-srad3*(math.cos(arc))
cairo_move_to (cr,hx0+sx1,hy0+sy1)
cairo_line_to (cr,hx0+sx2,hy0+sy2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+sx1,hy0+sy1)
cairo_line_to (cr,hx0+sx3,hy0+sy3)
cairo_stroke (cr)
--fs used home
mnrad1=srad3
mnrad2=mnrad1+10
br1,bg1,bb1,ba1=1,1,1,1
cairo_set_source_rgba (cr,br1,bg1,bb1,ba1)
cairo_arc (cr,hx0,hy0,mnrad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,mnrad2,0,2*math.pi)
cairo_stroke (cr)
for i=1,100 do
arc=((2*math.pi/360)*((360/100)*i))
mnx1=0+mnrad1*(math.sin(arc))
mny1=0-mnrad1*(math.cos(arc))
arc=((2*math.pi/360)*((360/100)*i))
mnx2=0+mnrad2*(math.sin(arc))
mny2=0-mnrad2*(math.cos(arc))
cairo_move_to (cr,hx0+mnx1,hy0+mny1)
cairo_line_to (cr,hx0+mnx2,hy0+mny2)
cairo_stroke (cr)
end
fsh=conky_parse('${fs_used_perc /home}')
mnrad3=mnrad2+10
arc=((2*math.pi/360)*((360/(100)*fsh)))
mnx1=0+mnrad2*(math.sin(arc))
mny1=0-mnrad2*(math.cos(arc))
arc=(2*math.pi/360)*((360/100)*((fsh))-4)
mnx2=0+mnrad3*(math.sin(arc))
mny2=0-mnrad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/100)*((fsh))+4)
mnx3=0+mnrad3*(math.sin(arc))
mny3=0-mnrad3*(math.cos(arc))
cairo_move_to (cr,hx0+mnx1,hy0+mny1)
cairo_line_to (cr,hx0+mnx2,hy0+mny2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+mnx1,hy0+mny1)
cairo_line_to (cr,hx0+mnx3,hy0+mny3)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,mnrad3,0,2*math.pi)
cairo_stroke (cr)
end
end

http://pix.toile-libre.org/upload/origi … 323253.png
Sorry if I did something ugly in your script...  roll

Ok I've found the error; in the conky I had the modifications of Sector11 with the maya heads.I've commented these and  only lauch one image like that :

${image ~/développement/Mayan/dec.png -p 171,171 -s 56x56}

It's works fine now; thank you smile

Last edited by ragamatrix (2012-12-12 15:16:12)

Offline

#4321 2012-12-12 16:10:26

ragamatrix
#! Junkie
From: Earth
Registered: 2012-12-05
Posts: 286

Re: Conky v1.9 Thread

I'm triyng to translate in french and something difficult for me to change something wrong : "wednesday le douze december" I'd like mercredi douze decembre I can't find the way... smile in the maya lua script:

--[[mayancalander by mrpeachy . version5.18.11
changes
improved and shortened number_to_words and date_to_words functions
increased number of settings (settings begin on line 65)
call in conkyrc like so
lua_load /path to file/filename.lua
lua_draw_hook_pre draw_fig

note about color and alpha
to set colors use the following format
color={0xFFFFFF,1}
         ^      ^
       color  alpha
]]
require 'cairo'
-------------------------------------------------------------------
function string:split(delimiter)
local result = { }
local from = 1
local delim_from, delim_to = string.find( self, delimiter, from )
while delim_from do
table.insert( result, string.sub( self, from , delim_from-1 ) )
from = delim_to + 1
delim_from, delim_to = string.find( self, delimiter, from )
end
table.insert( result, string.sub( self, from ) )
return result
end--of function
-------------------------------------------------------------------
function number_to_words(number)
--by mrpeachy 11-4-2012
number=tonumber(number)
local n_len=string.len(number)
if number>99 then
h=tonumber(string.sub(number,1,1))
tu=tonumber(string.sub(number,2,3))
t=tonumber(string.sub(number,2,2))
u=tonumber(string.sub(number,3,3))
elseif number<100 then
tu=number
t=tonumber(string.sub(number,1,1))
u=tonumber(string.sub(number,2,2))
end
n1_tab={"un","deux","trois","quatre","cinq","six","sept","huit","neuf","dix","onze","douze","treize","quatorze","quinze","seize","dix sept","dix huit","dix neuf",}
n2_tab={"dix","vingt","trente","quarante","cinquante","soixante","soixante dix","quatre vingt","quatre vingt dix"}
if tu<20 and tu~=10 and number~=0 then 
	nout=n1_tab[tu]
elseif tu==10 then
	nout="dix"
elseif tu>19 then
	if u>0 then 
	joinu=" " 
	u=n1_tab[u]
	else 
	joinu=""
	u=""
	end
	nout=n2_tab[t]..joinu..u
elseif number==0 then
nout="zero"
end
if number>99 and number~=100 then
	h=n1_tab[h]
	return h.." cent "..nout
elseif number==100 then
	return " cent "
elseif number<100 then
	return nout
end
end--function
---------------------------------------------------------------------
function date_to_words()
date=tonumber(os.date("%d"))
datecut=string.gsub(date, ".", "%1|")
datetable=string.split(datecut, "|")
d1_tab={d1="premier",d2="deux",d3="trois",d4="quatre",d5="cinq",d6="six",d7="sept",d8="huit",d9="neuf",d10="dix",d11="onze",d12="douze",d13="treize",d14="quatorze",d15="quinze",d16="seize",d17="dix sept",d18="dix huit",d19="dix neuf",d20="vingt",d30="trente"}
d2_tab={d2="vingt",d3="trente",}
if tonumber(date)<21 or tonumber(date)==30 then
return (d1_tab[tostring("d" .. date)])
elseif tonumber(date)>20 and tonumber(date)~=30 then
return (d2_tab[tostring("d" .. datetable[1])] .. " " .. d1_tab[tostring("d" .. datetable[2])])
end
end--function
----------------------------------------------------------------------
function rgb_to_r_g_b(col_a)
return ((col_a[1] / 0x10000) % 0x100) / 255., ((col_a[1] / 0x100) % 0x100) / 255., (col_a[1] % 0x100) / 255., col_a[2]
end
----------------------------------------------------------------------
function conky_draw_fig()
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 updates=tonumber(conky_parse('${updates}'))
if updates>5 then
--#########################################################################################################
--#########################################################################################################
--SETTINGS--SETTINGS--SETTINGS--SETTINGS--SETTINGS--SETTINGS--SETTINGS--SETTINGS--SETTINGS--SETTINGS--SETTINGS--
--center position
hx0,hy0=200,200
inner_radius=40
--line width
linew=1
--general settings to apply globally, can be altered/overriden for each section below
--line color and alpha
local global_line_color={0xFFFFFF,1}
--font
local font="mono"
--font size
local fsize=10
--text color and alpha
local global_text_color={0xFFFF00,1}
--gap under text
local tbg=3
--gap from indicator to text
local tig=6
--indicator circle width
local cw=10
--text circle width
local tcw=13
--indicator color and alpha
local global_indicator_color={0xFFFFFF,1}
--############################################
--settings for each section of calendar
--############################################
--MONTHS--------------------------------------
--line color and alpha
--eg month_line_color={0xFFFFFF,1}
local month_line_color=global_line_color
--text
local mfont=font
local mfsize=fsize
--text color and alpha
local month_text_color=global_text_color
--gap at bottom of text
local mtbg=tbg
--gap from indicator to text
local mtig=tig
--circle width
local mcw=cw
--text circle width
local mtcw=tcw
--indicator color and alpha
local month_indicator_color=global_indicator_color
--############################################
--DAYS----------------------------------------
--line color and alpha
--eg day_line_color={0xFFFFFF,1}
local day_line_color=global_line_color
--text
local dfont=font
local dfsize=fsize
--text color and alpha
local day_text_color=global_text_color
--gap at bottom of text
local dtbg=tbg
--gap from indicator to text
local dtig=tig
--circle width
local dcw=cw
--text circle width
local dtcw=tcw
--indicator color and alpha
local day_indicator_color=global_indicator_color
--############################################
--HOURS---------------------------------------
--line color and alpha
--eg hour_line_color={0xFFFFFF,1}
local hour_line_color=global_line_color
--text
local hfont=font
local hfsize=fsize
--text color
local hour_text_color=global_text_color
--gap at bottom of text
local htbg=tbg
--gap from indicator to text
local htig=tig
--indicator circle width
local hcw=cw
--text circle width
local htcw=tcw
--indicator color
local hour_indicator_color=global_indicator_color
--############################################
--MINUTES-------------------------------------
--line color and alpha
--eg min_line_color={0xFFFFFF,1}
local min_line_color=global_line_color
--text
local minfont=font
local minfsize=fsize
--text color and alpha
local min_text_color=global_text_color
--gap at bottom of text
local mintbg=tbg
--gap from indicator to text
local mintig=tig
--circle width
local mincw=cw
--text circle width
local mintcw=tcw
--indicator color and alpha
local min_indicator_color=global_indicator_color
--############################################
--SECONDS-------------------------------------
--line color and alpha
--eg sec_line_color={0xFFFFFF,1}
local sec_line_color=global_line_color
--text
local sfont=font
local sfsize=fsize
--text color and alpha
local sec_text_color=global_text_color
--gap at bottom of text
local stbg=tbg
--gap from indicator to text
local stig=tig
--circle width
local scw=cw
--text circle width
local stcw=tcw
--indicator color and alpha
local sec_indicator_color=global_indicator_color
--#################################################
--END OF SETTINGS--END OF SETTINGS--END OF SETTINGS
--#################################################
--months of the year---------------------------------------------------------------------------------------------------
mnrad1=inner_radius
mnrad2=mnrad1+mcw
cairo_set_source_rgba (cr,rgb_to_r_g_b(month_line_color))
--draw circles
cairo_set_line_width (cr,linew)
cairo_arc (cr,hx0,hy0,mnrad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,mnrad2,0,2*math.pi)
cairo_stroke (cr)
--calculations
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))
yeardays=31+febdaynum+31+30+31+30+31+31+30+31+30+31
yearsec=(yeardays*24*60*60)
jan=31*24*60*60
feb=jan+(febdaynum*24*60*60)
mar=feb+(31*24*60*60)
apr=mar+(30*24*60*60)
may=apr+(31*24*60*60)
jun=may+(30*24*60*60)
jul=jun+(31*24*60*60)
aug=jul+(31*24*60*60)
sep=aug+(30*24*60*60)
oct=sep+(31*24*60*60)
nov=oct+(30*24*60*60)
dec=nov+(31*24*60*60)
secdays = {jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec}
--circle indicator lines
for i=1,12 do
arc=((2*math.pi/360)*((360/yearsec)*(secdays[i])))
mnx1=0+mnrad1*(math.sin(arc))
mny1=0-mnrad1*(math.cos(arc))
arc=((2*math.pi/360)*((360/yearsec)*(secdays[i])))
mnx2=0+mnrad2*(math.sin(arc))
mny2=0-mnrad2*(math.cos(arc))
cairo_move_to (cr,hx0+mnx1,hy0+mny1)
cairo_line_to (cr,hx0+mnx2,hy0+mny2)
cairo_stroke (cr)
end
--indicator-----------------------------------------------------
cairo_set_source_rgba (cr,rgb_to_r_g_b(month_indicator_color))
doy=tonumber(os.date("%j"))
yrsecs=((doy-1)*24*60*60)+(tonumber(os.date('%H'))*60*60)+(tonumber(os.date('%M'))*60)+(tonumber(os.date('%S')))
mnrad3=mnrad2+mtcw
arc=(2*math.pi/360)*((360/yearsec)*(yrsecs))
mnx1=0+(mnrad2+linew)*(math.sin(arc))
mny1=0-(mnrad2+linew)*(math.cos(arc))
arc=(2*math.pi/360)*((360/yearsec)*((yrsecs))+4)
mnx2=0+mnrad3*(math.sin(arc))
mny2=0-mnrad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/yearsec)*((yrsecs))-4)
mnx3=0+mnrad3*(math.sin(arc))
mny3=0-mnrad3*(math.cos(arc))
cairo_move_to (cr,hx0+mnx1,hy0+mny1)
cairo_line_to (cr,hx0+mnx2,hy0+mny2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+mnx1,hy0+mny1)
cairo_line_to (cr,hx0+mnx3,hy0+mny3)
cairo_stroke (cr)
--circlewriting-------------------------------------------------
--text must be in quotes
text=((string.upper(os.date('%B'))) .. " DEUX MILLE " .. string.upper(number_to_words(os.date('%y'))))
start=((360/yearsec)*((yrsecs))+mtig)
slen2=string.len(text)
finish=start+270
circlewriting(text,mfont,mfsize,mnrad2+mtbg,hx0,hy0,month_text_color,start,finish)
--end of months around year-------------------------------------------------------------------------------------------------------------------------------
--##########################################################################################
--days around month----------------------------------------------------------------------
drad1=mnrad3
drad2=drad1+dcw
cairo_set_source_rgba (cr,rgb_to_r_g_b(day_line_color))
--draw circles
cairo_arc (cr,hx0,hy0,drad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,drad2,0,2*math.pi)
cairo_stroke (cr)
--calculations
monthnum=(tonumber(os.date('%m')))
monthdays = { 31, febdaynum, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
--drawin circle indicator lines
for i=1,monthdays[monthnum] do
arc=((2*math.pi/360)*((360/monthdays[monthnum])*(i)))
dx1=0+drad1*(math.sin(arc))
dy1=0-drad1*(math.cos(arc))
arc=((2*math.pi/360)*((360/monthdays[monthnum])*(i)))
dx2=0+drad2*(math.sin(arc))
dy2=0-drad2*(math.cos(arc))
cairo_move_to (cr,hx0+dx1,hy0+dy1)
cairo_line_to (cr,hx0+dx2,hy0+dy2)
cairo_stroke (cr)
end
--indicator
cairo_set_source_rgba (cr,rgb_to_r_g_b(day_indicator_color))
daynumsec=(tonumber(os.date('%d'))*24*60*60)+(tonumber(os.date('%H'))*60*60)+(tonumber(os.date('%M'))*60)+(tonumber(os.date('%S')))
monthnumsec=(monthdays[monthnum])*24*60*60
drad3=drad2+dtcw
arc=(2*math.pi/360)*((360/monthnumsec)*(daynumsec))
dx1=0+(drad2+linew)*(math.sin(arc))
dy1=0-(drad2+linew)*(math.cos(arc))
arc=(2*math.pi/360)*((360/monthnumsec)*((daynumsec))+4)
dx2=0+drad3*(math.sin(arc))
dy2=0-drad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/monthnumsec)*((daynumsec))-4)
dx3=0+drad3*(math.sin(arc))
dy3=0-drad3*(math.cos(arc))
cairo_move_to (cr,hx0+dx1,hy0+dy1)
cairo_line_to (cr,hx0+dx2,hy0+dy2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+dx1,hy0+dy1)
cairo_line_to (cr,hx0+dx3,hy0+dy3)
cairo_stroke (cr)
--circlewriting
text=((string.upper(os.date('%A'))) .. " LE " .. string.upper(date_to_words()))
start=((360/monthnumsec)*(daynumsec)+dtig)
slen1=string.len(text)
finish=start+(7.5*slen1)
circlewriting(text,dfont,dfsize,drad2+dtbg,hx0,hy0,day_text_color,start,finish)
--end of days around month-------------------------------------------------------------------------------------------------------
--##########################################################################################
--hours around day ---------------------------------------------------------------------------------------------------------------------
hrad1=drad3
hrad2=hrad1+hcw
cairo_set_source_rgba (cr,rgb_to_r_g_b(hour_line_color))
--draw eings
cairo_arc (cr,hx0,hy0,hrad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,hrad2,0,2*math.pi)
cairo_stroke (cr)
--draw ring indicator lines
for i=1,24 do
arc=((2*math.pi/360)*((360/24)*i))
hx1=0+hrad1*(math.sin(arc))
hy1=0-hrad1*(math.cos(arc))
arc=((2*math.pi/360)*((360/24)*i))
hx2=0+hrad2*(math.sin(arc))
hy2=0-hrad2*(math.cos(arc))
cairo_move_to (cr,hx0+hx1,hy0+hy1)
cairo_line_to (cr,hx0+hx2,hy0+hy2)
cairo_stroke (cr)
end
--indicator
cairo_set_source_rgba (cr,rgb_to_r_g_b(hour_indicator_color))
hrsec=(tonumber(os.date('%H'))*60*60)+(tonumber(os.date('%M'))*60)+(tonumber(os.date('%S')))
hrad3=hrad2+htcw
arc=((2*math.pi/360)*((360/(24*60*60)*hrsec)))
hx1=0+(hrad2+linew)*(math.sin(arc))
hy1=0-(hrad2+linew)*(math.cos(arc))
arc=(2*math.pi/360)*((360/(24*60*60))*(hrsec)-4)
hx2=0+hrad3*(math.sin(arc))
hy2=0-hrad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/(24*60*60))*(hrsec)+4)
hx3=0+hrad3*(math.sin(arc))
hy3=0-hrad3*(math.cos(arc))
cairo_move_to (cr,hx0+hx1,hy0+hy1)
cairo_line_to (cr,hx0+hx2,hy0+hy2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+hx1,hy0+hy1)
cairo_line_to (cr,hx0+hx3,hy0+hy3)
cairo_stroke (cr)
--circlewriting
hrnum=tonumber(os.date('%H'))
if hrnum==1 then hour="HEURE"
else hour="HEURES" end
text=((string.upper(number_to_words(hrnum))) .. " " .. hour)
start=((360/(24*60*60))*(hrsec)+htig)
slen4=string.len(text)
finish=start+(slen4*5)
circlewriting(text,hfont,hfsize,hrad2+htbg,hx0,hy0,hour_text_color,start,finish)
--end of hours around day----------------------------------------------------------------------------------------------------
--##########################################################################################
--minutes around hour--------------------------------------------------------------------------------------------------------------
minrad1=hrad3
minrad2=minrad1+mincw
cairo_set_source_rgba (cr,rgb_to_r_g_b(min_line_color))
--draw circles
cairo_arc (cr,hx0,hy0,minrad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,minrad2,0,2*math.pi)
cairo_stroke (cr)
--draw circle indicator lines
for i=1,60 do
arc=((2*math.pi/360)*((360/60)*i))
mx1=0+minrad1*(math.sin(arc))
my1=0-minrad1*(math.cos(arc))
arc=((2*math.pi/360)*((360/60)*i))
mx2=0+minrad2*(math.sin(arc))
my2=0-minrad2*(math.cos(arc))
cairo_move_to (cr,hx0+mx1,hy0+my1)
cairo_line_to (cr,hx0+mx2,hy0+my2)
cairo_stroke (cr)
end
--indicator
cairo_set_source_rgba (cr,rgb_to_r_g_b(min_indicator_color))
minsec=(tonumber(os.date('%M'))*60)+(tonumber(os.date('%S')))
minrad3=minrad2+mintcw
arc=((2*math.pi/360)*((360/(60*60)*minsec)))
mx1=0+(minrad2+linew)*(math.sin(arc))
my1=0-(minrad2+linew)*(math.cos(arc))
arc=(2*math.pi/360)*((360/(60*60))*(minsec)-4)
mx2=0+minrad3*(math.sin(arc))
my2=0-minrad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/(60*60))*(minsec)+4)
mx3=0+minrad3*(math.sin(arc))
my3=0-minrad3*(math.cos(arc))
cairo_move_to (cr,hx0+mx1,hy0+my1)
cairo_line_to (cr,hx0+mx2,hy0+my2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+mx1,hy0+my1)
cairo_line_to (cr,hx0+mx3,hy0+my3)
cairo_stroke (cr)
--circlewriting
min=tonumber(os.date('%M'))
if min==1 then minute="MINUTE"
else minute="MINUTES" end
text=((string.upper(number_to_words(min))) .. " " .. minute)
start=((360/(60*60))*(minsec)+mintig)
slen4=string.len(text)
finish=start+(slen4*5)
letterposition=0
circlewriting(text,minfont,minfsize,minrad2+mintbg,hx0,hy0,min_text_color,start,finish)
--end minutes around hour--------------------------------------------------------------------------------------
--##########################################################################################
--seconds of minute-------------------------------------------------------------------------------------------
srad1=minrad3
srad2=srad1+scw
cairo_set_source_rgba (cr,rgb_to_r_g_b(sec_line_color))
--draw circles
cairo_arc (cr,hx0,hy0,srad1,0,2*math.pi)
cairo_stroke (cr)
cairo_arc (cr,hx0,hy0,srad2,0,2*math.pi)
cairo_stroke (cr)
--draw circle indicator lines
for i=1,60 do
arc=((2*math.pi/360)*((360/60)*i))
sx1=0+srad1*(math.sin(arc))
sy1=0-srad1*(math.cos(arc))
arc=((2*math.pi/360)*((360/60)*i))
sx2=0+srad2*(math.sin(arc))
sy2=0-srad2*(math.cos(arc))
cairo_move_to (cr,hx0+sx1,hy0+sy1)
cairo_line_to (cr,hx0+sx2,hy0+sy2)
cairo_stroke (cr)
end
--indicator
cairo_set_source_rgba (cr,rgb_to_r_g_b(sec_indicator_color))
sec=(tonumber(os.date('%S')))
srad3=srad2+stcw
arc=((2*math.pi/360)*((360/(60)*sec)))
sx1=0+(srad2+linew)*(math.sin(arc))
sy1=0-(srad2+linew)*(math.cos(arc))
arc=(2*math.pi/360)*((360/60)*((sec))-4)
sx2=0+srad3*(math.sin(arc))
sy2=0-srad3*(math.cos(arc))
arc=(2*math.pi/360)*((360/60)*((sec))+4)
sx3=0+srad3*(math.sin(arc))
sy3=0-srad3*(math.cos(arc))
cairo_move_to (cr,hx0+sx1,hy0+sy1)
cairo_line_to (cr,hx0+sx2,hy0+sy2)
cairo_stroke (cr)
cairo_move_to (cr,hx0+sx1,hy0+sy1)
cairo_line_to (cr,hx0+sx3,hy0+sy3)
cairo_stroke (cr)
--outer circle
cairo_set_source_rgba (cr,rgb_to_r_g_b(sec_line_color))
cairo_arc (cr,hx0,hy0,srad3,0,2*math.pi)
cairo_stroke (cr)
--circlewriting
sec=tonumber(os.date('%S'))
if sec==1 then second="SECONDE"
else second="SECONDES" end
text=(string.upper(number_to_words(sec)) .. " " .. second)
start=((360/60)*((sec))+stig)
slen3=string.len(text)
finish=start+(slen3*5)
circlewriting(text,sfont,sfsize,srad2+stbg,hx0,hy0,sec_text_color,start,finish)
--end seconds of minute-----------------------------------------------------------------------------------------------------------------------------
--END OF CALENDAR
--#########################################################################################################
--#########################################################################################################
end-- if updates>5
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end-- end main function
---------------------------------------------------------------------------
function circlewriting(text, font, fsize, radi, horiz, verti, text_color, start, finish)
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize)
cairo_set_source_rgba (cr,rgb_to_r_g_b(text_color));
local inum=string.len(text)
deg=(finish-start)/(inum-1)
degrads=(math.pi/180)
local textcut=string.gsub(text, ".", "%1|")
texttable=string.split(textcut, "|")
for i=1,inum do
interval=(degrads*(start+(deg*(i-1))))
txs=0+radi*(math.sin(interval))
tys=0-radi*(math.cos(interval))
cairo_move_to (cr, txs+horiz, tys+verti);
cairo_rotate (cr, interval)
cairo_show_text (cr, (texttable[i]))
cairo_stroke (cr)
cairo_rotate (cr, -interval)
end
end--of function
---------------------------------------------------------------------------

Offline

#4322 2012-12-12 19:56:00

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: Conky v1.9 Thread

translating into French can be tricky because the number to words function uses the English format for saying numbers
lionhead made a modification to the number to words that translated to French... i think i have that somewhere
EDIT -- opps, he translated into German smile

but the date function would need to be adjusted also
unfortunately i dont have the knowledge of French to do it myself

Last edited by mrpeachy (2012-12-12 19:57:24)

Offline

#4323 2012-12-12 20:07:06

ragamatrix
#! Junkie
From: Earth
Registered: 2012-12-05
Posts: 286

Re: Conky v1.9 Thread

Thanks for answering so fast ; I'll find french help at the french forum; Didier-T knows enaugh lua to help me. Nice evening or afternoon if you're in us.
I've got ideas with this mayan script I find it very nice, you made really good script again !

Offline

#4324 2012-12-12 20:13:01

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: Conky v1.9 Thread

you are welcome
and thanks, this clock is one of my personal favorites also... and topical big_smile

Offline

Help fund CrunchBang, donate to the project!

#4325 2012-12-12 20:40:31

ragamatrix
#! Junkie
From: Earth
Registered: 2012-12-05
Posts: 286

Re: Conky v1.9 Thread

I see it's more difficult to translate than I thank....I can use it in English so.The Didier-T solution doesn't work:
lines 343 was:

text=((string.upper(os.date('%A'))) .. " LE " .. string.upper(date_to_words()))

Became:

line 291 :
[code]
text=((string.upper(os.date('%B'))) .. " DEUX MILLE " .. string.upper(number_to_words(os.date('%y'))))
[/code]
local jour=conky_parse( '${exec date +%A}' )
text=((string.upper(jour)) .. " LE " .. string.upper(date_to_words()))

became:

local mois=conky_parse( '${exec date +%B}' )
text=((string.upper(mois)) .. " DEUX MILLE " .. string.upper(number_to_words(os.date('%y'))))

nice try but doesn't work...

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat

Debian Logo