Conky

Bureaux,conky et autres personnalisations esthétiques.
Avatar du membre
Arizona
Messages : 9
Enregistré le : mar. 31 janv. 2017 11:49

Re: Conky

Messagepar Arizona » mar. 29 août 2017 17:12

Dernier message de la page précédente :

Bonjour,

Dans ton conky assure toi que la ligne suivante :

lua_load ./seamod_rings.lua corresponds bien à ton répertoire ou se trouve ton fichier.

@+
Kernel: 4.4.0-53-generic x86_64 (64 bit) Desktop: MATE 1.16.1 Distro: Linux Mint 18.1 Serena
Mobo: ASUSTeK model: Z87-DELUXE
CPU: Quad core Intel Core i7-4770K
Graphics: Card: Advanced Micro Devices [AMD/ATI] Tahiti XT [Radeon HD 7970/8970 OEM / R9 280X]

Jim777
Messages : 39
Enregistré le : mar. 21 juil. 2015 16:22

Re: Conky

Messagepar Jim777 » mar. 29 août 2017 17:33

merci mon loulou!!!t'est un champion du monde!!!Nickel est grand merci.
Modifié en dernier par zebulon le mar. 29 août 2017 23:05, modifié 1 fois.
Raison : suppression d'une citation reprenant à 100% le message précédent.
Linux Mint 18.2 Sonya - x64
SSD SanDisk Ultra®Plus
CPU : Intel® Core™ i7-870
RAM 8 Go DDR3
Carte Graphique: Radeon HD 4870

Avatar du membre
Gsxr
Messages : 134
Enregistré le : ven. 25 août 2017 15:49

Re: Conky

Messagepar Gsxr » mar. 29 août 2017 22:17

Super , problème réglé :mrgreen:
Modifié en dernier par Gsxr le mar. 29 août 2017 22:29, modifié 1 fois.
Linux Mint 18.2 - x64 - Kernel 4.10.0-33 - SSD 128 Go + 2 x HDD 2 To
Asus P8Z77-V LX2 - I5 3570K @ 4,5Ghz - 16Go DDR3 G.Skill Extreme Series
MSI GTX 1080Ti Gaming X - 11Go + Tuner DVB T2/T/C TBS 6221 + Webcam Logitech C920
Imprimante Samsung ML-2165W - Pingouin dans les champs, hiver méchant !

Jim777
Messages : 39
Enregistré le : mar. 21 juil. 2015 16:22

Re: Conky

Messagepar Jim777 » mar. 5 sept. 2017 20:27

conky modifié ;) merci a mon ami arizona pour son aide :B

Image
Linux Mint 18.2 Sonya - x64
SSD SanDisk Ultra®Plus
CPU : Intel® Core™ i7-870
RAM 8 Go DDR3
Carte Graphique: Radeon HD 4870

Avatar du membre
zebulon
Administrateur du site
Messages : 9732
Enregistré le : ven. 19 juin 2015 22:13
Localisation : Au pays du mistral

Re: Conky

Messagepar zebulon » mar. 5 sept. 2017 22:00

Salut ;)
Je rappelle qu'il serait sympa de mettre le code avec vos conkys 8-)

Merci ;)
LMDE MATE 64-bit, noyau: 4.9.0 +Lm 17.3 MATE.
Proc: intel I5 4440, Cm: Gigabyte GA-B85M-D3H, Alim: Corsair CX Bronze 430 W, Ram: Crucial Ballistix Sport, 2 x 2 Go.
SSD: 2.5 sandisk ultra+ 64 Go pour /+home, DD: Seagate Barracuda 500 Go pour mes données persos, DD maxtor 160 Go pour la sauvegarde ciblée via luckybackup.
Impr: HP Envy 4502.

Jim777
Messages : 39
Enregistré le : mar. 21 juil. 2015 16:22

Re: Conky

Messagepar Jim777 » mer. 6 sept. 2017 18:18

Image

Code : Tout sélectionner

# Conky settings #
background no
update_interval 1

cpu_avg_samples 2
net_avg_samples 2

override_utf8_locale yes

double_buffer yes
no_buffers yes

text_buffer_size 2048
#imlib_cache_size 0

temperature_unit celsius

# Window specifications #
own_window_class Conky
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below

border_inner_margin 0
border_outer_margin 0

minimum_size 520 600
maximum_width 520

alignment tr
gap_x -20
gap_y 100

# Graphics settings #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

default_color gray
default_shade_color red
default_outline_color green

# Text settings #
use_xft yes
override_utf8_locale yes
xftfont Pf Tempesta Five:bold:size=6
xftalpha 0.9
uppercase no

temperature_unit celsius

default_color 999999
color0 d00420
color1 999999
color2 1994D1
#color3 1994D1

# Lua Load  ##${voffset 750}
lua_load /home/eric/dark/rings-v1.2.1.lua_dark
#lua_draw_hook_pre ring_stats
lua_draw_hook_pre conky_main

TEXT
${font Pf Tempesta Five:bold:size=6}${voffset 16}${goto 128}${color1}${freq_g cpu0} Ghz ${nvidia temp} °C

${font Pf Tempesta Five:bold:size=6}${voffset -1}${goto 128}${color1}CPU 1${alignr 330}${color1}${cpu cpu0}%
${font Pf Tempesta Five:bold:size=6}${voffset 4}${goto 128}${color1}CPU 2${alignr 330}${color1}${cpu cpu1}%
${font Pf Tempesta Five:bold:size=6}${voffset 4}${goto 128}${color1}CPU 3${alignr 330}${color1}${cpu cpu2}%
${font Pf Tempesta Five:bold:size=6}${voffset 2}${goto 128}${color1}CPU 4${alignr 330}${color1}${cpu cpu3}%
${goto 50}${voffset 12}${font Pf Tempesta Five:bold:size=6}${color1}${top name 1}${alignr 306}${top cpu 1}%
${goto 50}${font Pf Tempesta Five:bold:size=6}${color1}${top name 2}${alignr 306}${top cpu 2}%
${goto 50}${font Pf Tempesta Five:bold:size=6}${color1}${top name 3}${alignr 306}${top cpu 3}%
${font Ubuntu:normal:size=18}${color3}${goto 80}${voffset 10}CPU   
${font Ubuntu:normal:size=18}${color3}${goto 400}${voffset 42}MÉMOIRE
${goto 320}${voffset -6}${font Pf Tempesta Five:bold:size=6}${color1}${top_mem name 1}${alignr 40}${top_mem mem 1}%
${goto 320}${font Pf Tempesta Five:bold:size=6}${color1}${top_mem name 2}${alignr 40}${top_mem mem 2}%
${goto 320}${font Pf Tempesta Five:bold:size=6}${color1}${top_mem name 3}${alignr 40}${top_mem mem 3}%
${goto 320}${font Pf Tempesta Five:bold:size=6}${color1}${top_mem name 4}${alignr 40}${top_mem mem 4}%
${goto 320}${font Pf Tempesta Five:bold:size=6}${color1}${top_mem name 5}${alignr 40}${top_mem mem 5}%
${font Pf Tempesta Five:bold:size=6}${voffset 6}${goto 350}${color1}SWAP${alignr 30}${color1}${swap} / ${color1}${swapmax}
${font Pf Tempesta Five:bold:size=6}${voffset 4}${goto 350}${color1}RAM ${alignr 30}${color1}${mem} / ${color1}${memmax}
${font Pf Tempesta Five:bold:size=6}${goto 80}${voffset -70}Root${color1}${alignr 310}${fs_used /} / ${fs_size /}
${font Pf Tempesta Five:bold:size=6}${goto 80}${voffset 2}Home${alignr 310}${color1}${fs_used /home} / ${fs_size /home}
${font Pf Tempesta Five:bold:size=6}${goto 80}${voffset 1}Usr${alignr 310}${color1}${fs_used /usr} / ${fs_size /usr}
${font Ubuntu:normal:size=18}${color3}${goto 30}${voffset 12}DISQUE DUR
${font Ubuntu:normal:size=18}${color3}${voffset 27}${goto 330}INTERNET
# |--ETH0
${font Pf Tempesta Five:bold:size=6}${color1}${goto 300}${voffset -10}Up${goto 350}${color1}${totalup enp5s0} / ${color1}${upspeed enp5s0}
${font Pf Tempesta Five:bold:size=6}${goto 300}${color1}Down${goto 350}${color1}${totaldown enp5s0} / ${color1}${downspeed enp5s0}
${font Pf Tempesta Five:bold:size=7}${goto 300}${voffset 2}Local IP${goto 350}${addr enp5s0}
${font Pf Tempesta Five:bold:size=7}${goto 300}${voffset -1}Public IP${goto 350}${texeci 1000 wget -q -O - checkip.dyndns.org | sed -e 's/[^[:digit:]\|.]//g'}
${font Ubuntu:normal:size=18}${goto 10}${voffset -45}${color3}${time %a} ${color3}${time %x}
${font Ubuntu:normal:size=22}${goto 70}${color3}${voffset 10}${time %H}:${time %M}
#${font Ubuntu:normal:size=18}${color0}${goto 300}${voffset 26}BATTERIE
#${font Ubuntu:normal:size=16}${color0}${goto 282}${voffset -2}${color1}${battery_percent BAT1}%${endif}${endif}


#${execpi 53 $HOME/conky/nagios.sh}



Code : Tout sélectionner

--[[
Ring Meters by londonali1010 (2009)

This script draws percentage meters as rings. It is fully customisable; all options are described in the script.

IMPORTANT: if you are using the 'cpu' function, it will cause a segmentation fault if it tries to draw a ring straight away. The if statement near the end of the script uses a delay to make sure that this doesn't happen. It calculates the length of the delay by the number of updates since Conky started. Generally, a value of 5s is long enough, so if you update Conky every 1s, use update_num > 5 in that if statement (the default). If you only update Conky every 2s, you should change it to update_num > 3; conversely if you update Conky every 0.5s, you should use update_num > 10. ALSO, if you change your Conky, is it best to use "killall conky; conky" to update it, otherwise the update_num will not be reset and you will get an error.

To call this script in Conky, use the following (assuming that you save this script to ~/scripts/rings.lua):
   lua_load ~/scripts/rings-v1.2.1.lua
   lua_draw_hook_pre ring_stats
   
Changelog:
+ v1.2.1 -- Fixed minor bug that caused script to crash if conky_parse() returns a nil value (20.10.2009)
+ v1.2 -- Added option for the ending angle of the rings (07.10.2009)
+ v1.1 -- Added options for the starting angle of the rings, and added the "max" variable, to allow for variables that output a numerical value rather than a percentage (29.09.2009)
+ v1.0 -- Original release (28.09.2009)

        arg=conky_parse("${if_up wlan0}wlan0${else}eth0${endif}"),
        fg_colour=0xf0651f,
        fg_colour=conky_parse("${if_up wlan0}wlan0${else}eth0${endif}"),
        conky_parse("${cpu}")
        name=conky_parse("${acpitemp}"),
]]

-- A TESTER
--set alarm value, this is the value at which bar color will change
--alarm_value=80
----set alarm bar color, 1,0,0,1 = red fully opaque
--ar,ag,ab,aa=1,0,0,1

-- couleurs 1
-- ffffff
-- f0651f
-- f01f42
-- couleurs 2 + flashy
-- 008cff
-- ff7200
-- ff000d

--normal_temp="0xffffff"
--warn_temp="0xf0651f"
--crit_temp="0xf01f42"
-- Un mélange des deux
normal="0xffffff"
warn="0xff7200"
crit="0xff000d"

-- seulement quand fond nécessaire
corner_r=35
bg_colour=0x2a2a2a
bg_alpha=0.2


settings_table = {
   
    {
        name='nvidia temp',
        arg='',
        max=90,
        bg_colour=0x2a2a2a,
        bg_alpha=0.8,
        fg_colour=0xffffff,
        fg_alpha=0.8,
        x=200, y=120,
        radius=97,
        thickness=4,
        start_angle=0,
        end_angle=240
    },
    {
        name='cpu',
        arg='cpu0',
        max=100,
        bg_colour=0x2a2a2a,
        bg_alpha=0.8,
        fg_colour=0xffffff,
        fg_alpha=0.8,
        x=200, y=120,
        radius=86,
        thickness=13,
        start_angle=0,
        end_angle=240
    },
    {
        name='cpu',
        arg='cpu1',
        max=100,
        bg_colour=0x2a2a2a,
        bg_alpha=0.8,
        fg_colour=0xffffff,
        fg_alpha=0.8,
        x=200, y=120,
        radius=71,
        thickness=12,
        start_angle=0,
        end_angle=240
    },
    {
        name='cpu',
        arg='cpu2',
        max=100,
        bg_colour=0x2a2a2a,
        bg_alpha=0.6,
        fg_colour=0xffffff,
        fg_alpha=0.8,
        x=200, y=120,
        radius=57,
        thickness=11,
        start_angle=0,
        end_angle=240
    },
    {
        name='cpu',
        arg='cpu3',
        max=100,
        bg_colour=0x2a2a2a,
        bg_alpha=0.5,
        fg_colour=0xffffff,
        fg_alpha=0.8,
        x=200, y=120,
        radius=44,
        thickness=10,
        start_angle=0,
        end_angle=240
    },
    {
        name='memperc',
        arg='',
        max=100,
        bg_colour=0x2a2a2a,
        bg_alpha=0.8,
        fg_colour=0xffffff,
        fg_alpha=0.8,
        x=340, y=234,
        radius=60,
        thickness=15,
        start_angle=180,
        end_angle=420
    },
    {
        name='swapperc',
        arg='',
        max=100,
        bg_colour=0x2a2a2a,
        bg_alpha=0.4,
        fg_colour=0xffffff,
        fg_alpha=0.8,
        x=340, y=234,
        radius=45,
        thickness=10,
        start_angle=180,
        end_angle=420
    },
    {
        name='fs_used_perc',
        arg='/',
        max=100,
        bg_colour=0x2a2a2a,
        bg_alpha=0.8,
        fg_colour=0xffffff,
        fg_alpha=0.8,
        x=220, y=280,
        radius=40,
        thickness=10,
        start_angle=0,
        end_angle=240
    },
    {
        name='fs_used_perc',
        arg='/home',
        max=100,
        bg_colour=0x2a2a2a,
        bg_alpha=0.6,
        fg_colour=0xffffff,
        fg_alpha=0.8,
        x=220, y=280,
        radius=28,
        thickness=10,
        start_angle=0,
        end_angle=240
    },
    {
        name='fs_used_perc',
        arg='/usr',
        max=100,
        bg_colour=0x2a2a2a,
        bg_alpha=0.4,
        fg_colour=0xffffff,
        fg_alpha=0.8,
        x=220, y=280,
        radius=16,
        thickness=10,
        start_angle=0,
        end_angle=240
    },
    {
        name='downspeedf',
        arg='enp5s0',
        max=1000,
        bg_colour=0x2a2a2a,
        bg_alpha=0.8,
        fg_colour=0xffffff,
        fg_alpha=0.8,
        x=290, y=346,
        radius=30,
        thickness=12,
        start_angle=180,
        end_angle=420
    },
    {
        name='upspeedf',
        arg='enp5s0',
        max=100,
        bg_colour=0x2a2a2a,
        bg_alpha=0.6,
        fg_colour=0xffffff,
        fg_alpha=0.8,
        x=290, y=346,
        radius=18,
        thickness=8,
        start_angle=180,
        end_angle=420
    },
    {
        name='time',
        arg='%S',
        max=60,
        bg_colour=0x2a2a2a,
        bg_alpha=0.8,
        fg_colour=0xffffff,
        fg_alpha=0.8,
        x=230, y=410,
        radius=30,
        thickness=12,
        start_angle=0,
        end_angle=240
    },
    {
        name='time',
        arg='%M',
        max=60,
        bg_colour=0x2a2a2a,
        bg_alpha=0.6,
        fg_colour=0xffffff,
        fg_alpha=0.8,
        x=230, y=410,
        radius=18,
        thickness=8,
        start_angle=0,
        end_angle=240
    },
    {
        name='time',
        arg='%H',
        max=24,
        bg_colour=0x2a2a2a,
        bg_alpha=0.4,
        fg_colour=0xffffff,
        fg_alpha=0.8,
        x=230, y=410,
        radius=10,
        thickness=4,
        start_angle=0,
        end_angle=240
    },
}

require 'cairo'

function rgb_to_r_g_b(colour,alpha)
   return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

function draw_ring(cr,t,pt)

   local w,h=conky_window.width,conky_window.height
   
   local xc,yc,ring_r,ring_w,sa,ea=pt['x'],pt['y'],pt['radius'],pt['thickness'],pt['start_angle'],pt['end_angle']
   local bgc, bga, fgc, fga=pt['bg_colour'], pt['bg_alpha'], pt['fg_colour'], pt['fg_alpha']

   local angle_0=sa*(2*math.pi/360)-math.pi/2
   local angle_f=ea*(2*math.pi/360)-math.pi/2
   local t_arc=t*(angle_f-angle_0)

   -- Draw background ring

   cairo_arc(cr,xc,yc,ring_r,angle_0,angle_f)
   cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
   cairo_set_line_width(cr,ring_w)
   cairo_stroke(cr)
   
   -- Draw indicator ring

   cairo_arc(cr,xc,yc,ring_r,angle_0,angle_0+t_arc)
   cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
   cairo_stroke(cr)      
end

function conky_ring_stats()
   local function setup_rings(cr,pt)
      local str=''
      local value=0
      
      str=string.format('${%s %s}',pt['name'],pt['arg'])
      str=conky_parse(str)
      
      value=tonumber(str)
      if value == nil then value = 0 end
      pct=value/pt['max']
      
      draw_ring(cr,pct,pt)
   end

   if conky_window==nil then return end
   local cs=cairo_xlib_surface_create(conky_window.display,conky_window.drawable,conky_window.visual, conky_window.width,conky_window.height)
   
   local cr=cairo_create(cs)   
   
   local updates=conky_parse('${updates}')
   update_num=tonumber(updates)

   if update_num>5 then
       for i in pairs(settings_table) do
                display_temp=temp_watch()
      setup_rings(cr,settings_table[i])
       end
   end
   cairo_surface_destroy(cs)
  cairo_destroy(cr)
end

function disk_watch()

    warn_disk=93
    crit_disk=98

    -- poser une boucle plus tard... pas simple

    disk=tonumber(conky_parse("${fs_used_perc /}"))

    if disk<warn_disk then
        settings_table[8]['fg_colour']=normal
    elseif disk<crit_disk then
        settings_table[8]['fg_colour']=warn
    else
        settings_table[8]['fg_colour']=crit
    end

    disk=tonumber(conky_parse("${fs_used_perc /home}"))

    if disk<warn_disk then
        settings_table[9]['fg_colour']=normal
    elseif disk<crit_disk then
        settings_table[9]['fg_colour']=warn
    else
        settings_table[9]['fg_colour']=crit
    end

    disk=tonumber(conky_parse("${fs_used_perc /usr}"))

    if disk<warn_disk then
        settings_table[10]['fg_colour']=normal
    elseif disk<crit_disk then
        settings_table[10]['fg_colour']=warn
    else
        settings_table[10]['fg_colour']=crit
    end
end

function temp_watch()

    warn_value=70
    crit_value=80

    temperature=tonumber(conky_parse("${acpitemp}"))

    if temperature<warn_value then
        settings_table[1]['fg_colour']=normal
    elseif temperature<crit_value then
        settings_table[1]['fg_colour']=warn
    else
        settings_table[1]['fg_colour']=crit
    end
end

function conky_draw_bg()
    if conky_window==nil then return end
    local w=conky_window.width
    local h=conky_window.height
    local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
    cr=cairo_create(cs)
   
    cairo_move_to(cr,corner_r,0)
    cairo_line_to(cr,w-corner_r,0)
    cairo_curve_to(cr,w,0,w,0,w,corner_r)
    cairo_line_to(cr,w,h-corner_r)
    cairo_curve_to(cr,w,h,w,h,w-corner_r,h)
    cairo_line_to(cr,corner_r,h)
    cairo_curve_to(cr,0,h,0,h,0,h-corner_r)
    cairo_line_to(cr,0,corner_r)
    cairo_curve_to(cr,0,0,0,0,corner_r,0)
    cairo_close_path(cr)
   
    cairo_set_source_rgba(cr,rgb_to_r_g_b(bg_colour,bg_alpha))
    cairo_fill(cr)
end


function conky_main()
    temp_watch()
    disk_watch()
    conky_ring_stats()
-- quand fond nécessaire
--    conky_draw_bg()
end
Linux Mint 18.2 Sonya - x64
SSD SanDisk Ultra®Plus
CPU : Intel® Core™ i7-870
RAM 8 Go DDR3
Carte Graphique: Radeon HD 4870

Avatar du membre
débitant
Messages : 5891
Enregistré le : mar. 14 juil. 2015 18:22
Localisation : Lorraine France

Re: Conky

Messagepar débitant » mer. 6 sept. 2017 18:21

merci pour les balises :lol: j'étais justement en train de les reprendre :lol: ;)

EDIT: d'où l'intérêt de faire "aperçu" avant d'envoyer, tu t'en serais rendu compte ;)

Avatar du membre
loutch
Messages : 293
Enregistré le : lun. 13 juil. 2015 17:32

Re: Conky

Messagepar loutch » ven. 8 sept. 2017 09:53

Hello

Image

conky position soleil et lune haut à droite
soleil

Code : Tout sélectionner

background no
use_xft yes
xftfont URW Chancery L:style=Bold:size=10
xftalpha 1
update_interval 1
total_run_times 0
own_window yes
own_window_transparent yes
own_window_argb_visual yes
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager
double_buffer yes
minimum_size 380 310
maximum_width 380
text_buffer_size 2048
draw_shades no
draw_outline no
draw_borders no
border_width 1
draw_graph_borders no
default_outline_color cacaca
alignment top_right
gap_x 5
gap_y 100
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
#
color1                ffff00


lua_load ~/.conky/v11/conky/soleil.lua
lua_draw_hook_pre draw_fig

default_color 8b8b8b
   


lua_load ~/.conky/lua/image.lua

TEXT

${lua fDrawImage /home/loutch/.conky/v11/conky/terre.png 170 170 60 64 0}




soleil.lua

Code : Tout sélectionner

--sun position lua script by mrpeachy 2010 version 2 includes moon position
--############################################################
--############################################################
--input latitude
--for northern hemisphere enter positive
--for southern hemisphere enter negative
latitude=49.1
longitude=7.06
--input hemisphere
--for northern enter 1
--for southern enter 2
hemisphere=1
--daylight saving? 1=yes, 0=no
dst=0
--position - this is the point where the N-S line crosses the horizon line
--the .5 helps make lines look sharper
across=200.5
down=200.5
--############################################################
--############################################################
require 'cairo'

function cos(x)
a=math.cos(math.rad(x))
return a
end

function sin(x)
a=math.sin(math.rad(x))
return a
end

function tan(x)
a=math.tan(math.rad(x))
return a
end

function addzero10(num)
if tonumber(num) < 10 then
return "0" .. num
else
return num
end
end

function round(val, decimal)
  if (decimal) then
    return math.floor( (val * 10^decimal) + 0.5) / (10^decimal)
  else
    return math.floor(val+0.5)
  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 datan2(y, x)
    if x == 0 and y == 0 then
        return 0
        else a = math.atan(math.rad(y / x))
    end
    if (x < 0) then
    a = a + 180
        else if y < 0 and x > 0 then
        a = a + 360
        end
    end
return math.rad(a)
end

function ipart(x)
if (x> 0) then
a = math.floor(x)
else a = math.ceil(x);
end
return a
end

function range(x)
    b = x / 360;
    a = 360 * (b - ipart(b));
    if a  < 0 then
        a = a + 360
end
    return a
end

function ranget(x)
    b = x / 24;
    a = 24 * (b - ipart(b));
    if a  < 0 then
        a = a + 24
end
    return a
end

function rangei(x)
    b = x / 1440;
    a = 1440 * (b - ipart(b));
    if a  < 0 then
        a = a + 1440
end
    return a
end
--################################################################################################################################################
--###########   MAIN 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}'))
--###########   START FUNCTION   ########################################################################################################
if updates > 5 then
--###########   SET HEMISPHERE   ########################################################################################################
if hemisphere==1 then
start=0
else
start=180
end
--################ sets daylignt saving #####################################3
if dst==1 then ds=-1 else ds=0 end
--################################################################################################################################################
--################################################################################################################################################
--###########  calculate julian time   ########################################################################################################
--################################################################################################################################################
--################################################################################################################################################
M=os.date("%m") --month
K=os.date("%G") --4 digit year
I=(os.date("%d"))--day of month
H=ranget((os.date("%H"))+ds) --hours
Min=os.date("%M")
Mi=(os.date("%M"))/60 --minutes expressed as hours
--current Julian time-----------------------------------------------------------------
JD=round((367*K)-((7*(K+((M+9)/12)))/4)+((275*M)/9)+I+1721013.5,0)+0.5+((H+Mi)/24)
--------------------------------------------------------------------------------------
days=(JD)-2451545.0 --correct
T=days/36525 --correct
--Julian time at preceeding midnight
JD0=round((367*K)-((7*(K+((M+9)/12)))/4)+((275*M)/9)+I+1721013.5,0)+0.5
D0=JD0-2451545.0
--###########  calculate sidereal time   ########################################################################################################
--current sidereal time
CST=6.697374558+(0.06570982441908*D0)+(1.00273790935*(H+Mi))
-----------------------------------------------------------------
GMST = 6.697374558 + (0.06570982441908*D0) + (1.00273790935*(H+Mi)) + (0.000026*(T^2))
ADJ=longitude/15
GMST24=ranget(GMST)
GMST24S=string.split(GMST24, "%p")
GMST24H=GMST24S[1]
GMST24M=string.len(GMST24S[2])
GMST24M=GMST24S[2]/(10^(GMST24M))*60
GMST24M=string.split(GMST24M,"%p")
GMST24M=GMST24M[1]
sgtime=(GMST24H*60)+GMST24M
-------------------------------------------------------------
day=os.date("%j")
B=(360/365)*(day-81)
eot=(9.87*math.sin(2*B))-(7.53*math.cos(B))-(1.5*math.sin(B))
LSTM=15*10
TC=(4*(LSTM-longitude))+eot
LT=((H)*60)+Min
LST=LT+(TC/60)
---------------------------------------
LST24=ranget(LST/60)
LST24S=string.split(LST24, "%p")
LST24H=LST24S[1]
LST24M=string.len(LST24S[2])
LST24M=(LST24S[2]/(10^(LST24M)))*60
LST24M=string.split(LST24M,"%p")
LST24M=LST24M[1]
--below is current solar time
stime=(LST24H*60)+LST24M
--################################################################################################################################################
--#############  END TIME CALCS ###########################################################################################################
--################################################################################################################################################
--################################################################################################################################################
--#############  SUN CACULATIONS AND DISPLAY ###########################################################################################################
--################################################################################################################################################
--################################################################################################################################################
--################################################################################################################################################
--    Sun formulas
--
--    L1    - Mean longitude
--    M1    - Mean anomaly
--    C1    - Equation of centre
--    V1    - True anomaly
--    Ec1    - Eccentricity
--    R1    - Sun distance
--    Th1    - Theta (true longitude)
--    Om1    - Long Asc Node (Omega)
--    Lam1- Lambda (apparent longitude)
--    Obl    - Obliquity of ecliptic
--    Ra1    - Right Ascension
--    Dec1- Declination
t=T
L1 = range(280.466 + 36000.8 * t)
M1 = range(357.529+35999*t - 0.0001536* t*t + t*t*t/24490000)
sinm1=math.sin(math.rad(M1))
C1 = (1.915 - 0.004817* t - 0.000014* t * t)* sinm1;     
C1 = C1 + (0.01999 - 0.000101 * t)* sinm1;
C1 = C1 + 0.00029 * sinm1;
V1 = M1 + C1;
cosv1=math.cos(math.rad(V1))
Ec1 = 0.01671 - 0.00004204 * t - 0.0000001236 * t*t;
R1 = 0.99972 / (1 + Ec1 * cosv1);--correct
Th1 = L1 + C1
Om1 = range(125.04 - 1934.1 * t)
om1sin=math.sin(math.rad(Om1))
Lam1 = Th1 - 0.00569 - 0.00478 * math.deg(om1sin);
Obl = (84381.448 - 46.815 * t)/3600; --correct
th1sin=math.sin(math.rad(Th1))
th1cos=math.cos(math.rad(Th1))
th1tan=math.tan(math.rad(Th1))
oblsin=math.sin(math.rad(Obl))
oblcos=math.cos(math.rad(Obl))
obltan=math.tan(math.rad(Obl))
zsin=math.sin(math.rad(0))
zcos=math.cos(math.rad(0))
ztan=math.tan(math.rad(0))
Ra1 = datan2((th1sin * oblcos - ztan* zsin),th1cos)--close ish
Dec1 = math.asin(zsin* oblcos + zcos*oblsin*th1sin)--very close
--SUN CALCULATIONS---------------------------------------------------------------
-------------------------------------------------------
delta=math.deg(Dec1)
------------------------------------------------------
sdec=delta
--calculate hangle in relation to altitude in relation to time
althrtab={}
shartab={}
total=1440
for i=1,total do
sha=180+(i*(360/total))
cossha=math.cos(math.rad(sha))
cossundec=math.cos(math.rad(sdec))
coslat=math.cos(math.rad(latitude))
cosmath=cossha*cossundec*coslat
sinsundec=math.sin(math.rad(sdec))
sinlat=math.sin(math.rad(latitude))
sinmath=sinsundec*sinlat
sinelevation=cosmath+sinmath
elevation=math.deg(math.asin(sinelevation))
curaltlong=elevation
curalt=round(curaltlong,2)
althrtab[i]=curalt
shartab[i]=sha-360
end
--#############################################
--calculate sunrise and sunset
for i=1,(total-1) do
if althrtab[i]<0 and althrtab[i+1]>0 then
rise=i
end
if althrtab[i]>0 and althrtab[i+1]<0 then
set=i
end
end
rise=rise/60
rises=string.split(rise,"%p")
sriseh=rises[1]
riseml=string.len(rises[2])
risem=(rises[2]/(10^riseml))*60
risems=string.split(risem,"%p")
srisem=risems[1]
set=set/60
sets=string.split(set,"%p")
sseth=sets[1]
setml=string.len(sets[2])
setm=(sets[2]/(10^setml))*60
setms=string.split(setm,"%p")
ssetm=setms[1]
--#############################################
--calculate azimuth for all above points
if hemisphere==1 then
azitab={}
for i=1,total do
azmath1=(math.cos(math.rad(shartab[i]))*cossundec*sinlat)-(sinsundec*coslat)
azmath2=math.cos(math.rad(althrtab[i]))
cosaz=azmath1/azmath2
azi1=math.deg(math.acos(cosaz))
aziplot=azi1
if shartab[i]<0 then
azitab[i]=(aziplot-180)*-1
else
azitab[i]=aziplot+180
end
end
end--if hemishpere
if hemisphere==2 then
azitab={}
for i=1,total do
azmath1=(math.cos(math.rad(shartab[i]))*cossundec*sinlat)-(sinsundec*coslat)
azmath2=math.cos(math.rad(althrtab[i]))
cosaz=azmath1/azmath2
azi1=math.deg(math.acos(cosaz))
aziplot=azi1
if shartab[i]<0 then
azitab[i]=(aziplot-360)*-1
else
azitab[i]=aziplot--+180
end
end
end--if hemishpere
------------------------------------------------------------------------------
--diplay sun plot
for i = 1,total do
circrad=0.25
circx=across-180+azitab[i]
circy=down-althrtab[i]
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_set_source_rgba(cr,0.4,0.4,0.4,1)
cairo_fill (cr)
end
--plot current sun position
circrad=7
circx=across-180+azitab[stime]
circy=down-althrtab[stime]
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_set_source_rgba(cr,1,1,0,1)
cairo_fill (cr)
-------------------------------
--curerent sun alt and azi
sunalt=althrtab[stime]
sunazi=azitab[stime]
--------------------------------------------
--############################################################################
--draw vertical N-S line
cairo_set_line_width (cr, 1)
cairo_set_source_rgba(cr,0.5,0.5,0.5,1)
cairo_move_to (cr, across, down+100)
cairo_line_to (cr, across, down-100)
cairo_stroke (cr)
--draw horizon
cairo_move_to (cr, across-180, down)
cairo_line_to (cr, across+180, down)
cairo_stroke (cr)
if hemisphere==1 then
cairo_move_to (cr, across-4, down-102)
cairo_show_text (cr, "S")
cairo_move_to (cr, across-4, down+109)
cairo_show_text (cr, "N")
else
cairo_move_to (cr, across-4, down-102)
cairo_show_text (cr, "N")
cairo_move_to (cr, across-4, down+109)
cairo_show_text (cr, "S")
cairo_stroke (cr)
end
--################################################################################################################################################
--################################################################################################################################################
--################################################################################################################################################
--################################################################################################################################################
--################################################################################################################################################
--#############  MOON CACULATIONS AND DISPLAY ###########################################################################################################
--################################################################################################################################################
--################################################################################################################################################
--################################################################################################################################################
--calculate moon data----------------------------------------------------------------
--moon stuff
F = range(93.2721 + 483202 * t - 0.003403 * t* t - t * t * t/3526000);
L2 = range(218.316 + 481268 * t);
Om2 = range(125.045 - 1934.14 * t + 0.002071 * t * t + t * t * t/450000);
M2 = range(134.963 + 477199 * t + 0.008997 * t * t + t * t * t/69700);
cosm2=math.cos(math.rad(M2))
D = range(297.85 + 445267 * t - 0.00163 * t * t + t * t * t/545900);
D2 = 2*D;
cosd2m2=math.cos(math.rad(D2-M2))
cosd2=math.cos(math.rad(D2))
R2 = 1 + (-20954 * cosm2 - 3699 * cosd2m2 - 2956 * cosd2 / 385000);
R3 = (R2 / R1) / 379.168831168831;
sinf=math.sin(math.rad(F))
sinm2f=math.sin(math.rad(M2-F))
sind2f=math.sin(math.rad(D2-F))
Bm = 5.128 * sinf + 0.2806 * sinm2f;
Bm = Bm + 0.2777 * sinm2f + 0.1732 * sind2f;
sinm2=math.sin(math.rad(M2))
sind2m2=math.sin(math.rad(D2-M2))
sind2=math.sin(math.rad(D2))
Lm = 6.289 * sinm2 + 1.274 * sind2m2 + 0.6583 * sind2;
sin2m2=math.sin(math.rad(2*M2))
sin2f=math.sin(math.rad(2*F))
Lm = Lm + 0.2136 * sin2m2 - 0.1851 * sinm1 - 0.1143 * sin2f;
sind22m2=math.sin(math.rad(D2-(2*M2)))
Lm = Lm +0.0588 * sind22m2
sind2m1m2=math.sin(math.rad(D2-M1-M2))
sind2m22=math.sin(math.rad(D2+M2))
Lm = Lm + 0.0572* sind2m1m2 + 0.0533* sind2m22;
Lm = Lm + L2;
tanbm=math.tan(math.rad(Bm))
sinbm=math.sin(math.rad(Bm))
cosbm=math.cos(math.rad(Bm))
sinlm=math.sin(math.rad(Lm))
coslm=math.cos(math.rad(Lm))
Ra2 = math.atan((sinlm * oblcos - tanbm* oblsin));
Dec2 = math.asin(sinbm* oblcos + cosbm*oblsin*sinlm);
sinlam1lm=math.sin(math.rad(Lam1-Lm))
HLm = range(Lam1 + 180 + (180/math.pi) * R3 * cosbm * sinlam1lm);
HBm = R3 * Bm;
--------------------------------------------------------------------
--obliquity of ecliptic:
eps = 23.0 + 26.0/60.0 + 21.448/3600.0 - (46.8150*T+ 0.00059*T*T- 0.001813*T*T*T)/3600;
X = cos(Bm)*cos(Lm)
Y = cos(eps)*cos(Bm)*sin(Lm) - sin(eps)*sin(Bm)
Z = sin(eps)*cos(Bm)*sin(Lm) - cos(eps)*sin(Bm)
R = math.sqrt(1.0-Z*Z);
delta = (180/math.pi)*math.atan(Z/R); -- in degrees-- declination
RA = (24/math.pi)*math.atan(Y/(X+R)); -- in hours
-------------------------------------------------------
delta=math.deg(Dec2)
------------------------------------------------------
sdec=delta
althrtab={}
shartab={}
total=1440
cossundec=math.cos(math.rad(sdec))
coslat=math.cos(math.rad(latitude))
sinlat=math.sin(math.rad(latitude))
sinsundec=math.sin(math.rad(sdec))
sinmath=sinsundec*sinlat
for i=0,total do
sha=180+(i*(360/total))
cossha=math.cos(math.rad(sha))
cosmath=cossha*cossundec*coslat
sinelevation=cosmath+sinmath
elevation=math.deg(math.asin(sinelevation))
curaltlong=elevation
curalt=round(curaltlong,2)
althrtab[i]=curalt
shartab[i]=sha-360
end
--#############################################
--calculate moonrise and moonset
for i=1,(total-1) do
if althrtab[i]<0 and althrtab[i+1]>0 then
rise=i
end
if althrtab[i]>0 and althrtab[i+1]<0 then
set=i
end
end
rise=rise/60
rises=string.split(rise,"%p")
mriseh=rises[1]
riseml=string.len(rises[2])
risem=(rises[2]/(10^riseml))*60
risems=string.split(risem,"%p")
mrisem=risems[1]
set=set/60
sets=string.split(set,"%p")
mseth=sets[1]
setml=string.len(sets[2])
setm=(sets[2]/(10^setml))*60
setms=string.split(setm,"%p")
msetm=setms[1]
--#############################################
--calculate azimuth for all above points
if hemisphere==1 then
azitab={}
for i=1,total do
azmath1=(math.cos(math.rad(shartab[i]))*cossundec*sinlat)-(sinsundec*coslat)
azmath2=math.cos(math.rad(althrtab[i]))
cosaz=azmath1/azmath2
azi1=math.deg(math.acos(cosaz))
aziplot=azi1
if shartab[i]<0 then
azitab[i]=(aziplot-180)*-1
else
azitab[i]=aziplot+180
end
end
end--if hemishpere
if hemisphere==2 then
azitab={}
for i=1,total do
azmath1=(math.cos(math.rad(shartab[i]))*cossundec*sinlat)-(sinsundec*coslat)
azmath2=math.cos(math.rad(althrtab[i]))
cosaz=azmath1/azmath2
azi1=math.deg(math.acos(cosaz))
aziplot=azi1
if shartab[i]<0 then
azitab[i]=(aziplot-360)*-1
else
azitab[i]=aziplot
end
end
end--if hemishpere
------------------------------------------------------------------------------
--diplay moon plot
for i = 1,total do
circrad=0.25
circx=across-180+azitab[i]
circy=down-althrtab[i]
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_set_source_rgba(cr,0.7,0.7,0.7,1)
cairo_fill (cr)
end
--plot current moon position
madj=tostring(rangei(sgtime+360))
mtime=madj
circrad=5
circx=across-180+(azitab[tonumber(mtime)])
circy=down-(althrtab[tonumber(mtime)])
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_set_source_rgba(cr,1,1,1,1)
cairo_fill (cr)
-------------------------------
--curerent moon alt and azi
moonalt=althrtab[tonumber(mtime)]
moonazi=azitab[tonumber(mtime)]
---------------------------------------------
--################################################################################################################################################
--################################################################################################################################################
--#############  TEXT DISPLAYS ###########################################################################################################
--################################################################################################################################################
--################################################################################################################################################
--################################################################################################################################################
--draws text label
font="Mono"
fontsize=10
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fontsize);
cairo_set_source_rgba (cr, 0.1, 0.1, 0.1, 0.5);
--top left - sun moon alt and azi

tlx=20
tly=20
adj=10
cairo_move_to (cr, tlx, tly)
cairo_show_text (cr, "Positions")
gap=10
add=fontsize+((fontsize/100)*adj)+gap
cairo_move_to (cr, tlx, tly+add)
cairo_show_text (cr, "Soleil")
add=fontsize+((fontsize/100)*adj)+add
cairo_move_to (cr, tlx, tly+add)
cairo_show_text (cr, "Azimut " .. round(sunazi,2) .. "°")
add=fontsize+((fontsize/100)*adj)+add
cairo_move_to (cr, tlx, tly+add)
cairo_show_text (cr, "Altitude " .. sunalt .. "°")
gap=10
add=fontsize+((fontsize/100)*adj)+add+gap
cairo_move_to (cr, tlx, tly+add)
cairo_show_text (cr, "Lune")
add=fontsize+((fontsize/100)*adj)+add
cairo_move_to (cr, tlx, tly+add)
cairo_show_text (cr, "Azimut " .. round(moonazi,2) .. "°")
add=fontsize+((fontsize/100)*adj)+add
cairo_move_to (cr, tlx, tly+add)
cairo_show_text (cr, "Altitude " .. moonalt .. "°")

tlx=180
tly=20
adj=10
cairo_move_to (cr, tlx, tly)
cairo_show_text (cr, "Heure")
gap=10
add=fontsize+((fontsize/100)*adj)+gap
cairo_move_to (cr, tlx, tly+add)
cairo_show_text (cr, "Heure  Locale: " .. H .. ":" .. Min)
add=fontsize+((fontsize/100)*adj)+add
cairo_move_to (cr, tlx, tly+add)
cairo_show_text (cr, "Heure Sidérale: " .. GMST24H .. ":" .. GMST24M )
add=fontsize+((fontsize/100)*adj)+add
cairo_move_to (cr, tlx, tly+add)
cairo_show_text (cr, "Heure Solaire : " .. LST24H .. ":" .. LST24M)
cairo_stroke (cr)
--#######################################################################
--###########################################################################################
--###########################################################################################
--###########################################################################################
--###########################################################################################
end-- end if updates =
end--end main function


terre+lune

Code : Tout sélectionner

background no
use_xft yes
xftfont GE Inspira:size=10
xftalpha 1
update_interval 1
total_run_times 0
own_window yes
own_window_transparent yes
own_window_argb_visual yes
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager
double_buffer yes
minimum_size 210 210
maximum_width 210
text_buffer_size 2048
draw_shades no
draw_outline no
draw_borders no
border_width 1
draw_graph_borders no
default_color gray30
default_outline_color cacaca
alignment top_right
gap_x 470
gap_y 54
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
#
color1                ffff00

lua_load ~/.conky/lua/image.lua

TEXT

${voffset 120}
${goto 5}${font ConkyWeather:size=12}a ${voffset -3}${font monofur:bold:size=12:}↑$font ${execi 3600 sed -n '15p' $HOME/1_accuweather/curr_cond}              ${goto 120}${voffset  3}${font ConkyWeather:size=12}A ${voffset -3}${font monofur:bold:size=12:}↑$font ${execi 3600 sed -n '19p' $HOME/1_accuweather/curr_cond}
${goto 21}${font monofur:bold:size=12:}↓$font ${execi 3600 sed -n '16p' $HOME/1_accuweather/curr_cond}                                                         ${goto 136}${font monofur:bold:size=12:}↓$font ${execi 3600 sed -n '20p' $HOME/1_accuweather/curr_cond}
${goto 5}Durée ${execi 3600 sed -n '17p' $HOME/1_accuweather/curr_cond}                                                                                       ${goto 120}Durée ${execi 3600 sed -n '21p' $HOME/1_accuweather/curr_cond}
${goto 14}${execi 3600 sed -n '6p' $HOME/2b_Wunderground_API/Moon_Sun} Visibilité ${execi 3600 sed -n '2p' $HOME/2b_Wunderground_API/Moon_Sun} %

${execi 30 sh /home/loutch/.conky/v11/scripts/terrejn.sh}
${lua fDrawImage /home/loutch/.conky/v11/image/image1.png 0 10 168 142 0}
${lua fDrawImage $HOME/2b_Wunderground_API/Moon_phase.png 150 5 40 40 0}


terrejn.sh

Code : Tout sélectionner

#!/bin/bash
#http://www.goes.noaa.gov/FULLDISK/GMIR.JPG
#http://www.ruwenzori.net/earth/Earth_EMEA+Atlantic_1280x1024.jpg
#http://oiswww.eumetsat.org/IPPS/html/latestImages/EUMETSAT_MSG_IR039Color-all.jpg

# script detour_terre.sh
wget -q -O   /home/loutch/.conky/v11/image/image1.jpg http://www.ruwenzori.net/earth/Earth_EMEA+Atlantic_1280x1024.jpg
# pour le cadrage et le diametre si il ya lieu jouer sur 630,50
convert -size 1280x1024 xc:none -fill blue -draw 'circle 640,512 630,50' -alpha extract /tmp/mask.png
convert  /home/loutch/.conky/v11/image/image1.jpg  /tmp/mask.png  -alpha off -compose CopyOpacity -composite /home/loutch/.conky/v11/image/image1.png
rm /tmp/mask.png
#attention l'image finale et en .png a modifier dans ton conky
# ${image  /home/idem/image1.png -p 0,0 -s 500x400 -f 60}


Square to round.lua(pour avoir la terre ronde)

Code : Tout sélectionner

--[[ SQUARE_TO_ROUND WIDGET by Wlourf (07 April 2010, version 1.0.1)
http://u-scripts.blogspot.com/

This widget display a rounded image on your conky from a square image only.

Parameters are
filename        --nom de l'image carrée en entrée
xc,yc           --coordonnées du centre de l'image ronde par rapport au coin en haut à gauche de la fenêtre conky
radius           --rayon du cercle final
angle           --angle de rotation de l'image
radius_crop       --dans l'image carrée, pourcentage du cercle à extraire par rapport au côté du carré(1-100)
period       --converti l'image de carré à rond toutes les  'period' secondes

]]

require 'cairo'
require 'imlib2'

function convert_square(fileIn,fileOut,radius,angle,radius_crop)
    --convert Input file from jpg to png, scale it and rotate it
    local imageInput = imlib_load_image(fileIn)
    local out_size = radius*2/(radius_crop/100)
    imlib_context_set_image(imageInput)
    w = imlib_image_get_width();
    h = imlib_image_get_height();
    imlib_image_set_format("png")
    buffer = imlib_create_image(out_size,out_size);
    imlib_context_set_image(buffer);

    imlib_blend_image_onto_image(imageInput, 0,
                                               0, 0, w, h,
                                               0,0, out_size,out_size)
    rot_img=imlib_create_rotated_image(angle*math.pi/180)
    imlib_context_set_image(rot_img) 
    imlib_save_image(fileOut)
    imlib_free_image()
   
    imlib_context_set_image(buffer)
    imlib_free_image()
    imlib_context_set_image(imageInput)
    imlib_free_image()
end

function crop_square_to_round(filename,xc,yc,radius)
    local surface = cairo_image_surface_create_from_png(filename)
    local img_w = cairo_image_surface_get_width (surface);
   
    local cw,ch = conky_window.width, conky_window.height
    local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, cw,ch)
    local cr=cairo_create(cs)
    cairo_translate(cr,xc-img_w/2,yc-img_w/2)
    cairo_arc (cr, img_w/2,img_w/2, radius, 0, 2*math.pi)
    cairo_clip (cr)
    cairo_new_path (cr)   
    cairo_set_source_surface (cr, surface, 0, 0)

    cairo_paint (cr)
    cairo_destroy(cr)
    cairo_surface_destroy (cs)
    cairo_surface_destroy (surface)
   
end

function display_round(filename,xc,yc,radius,angle,radius_crop,period)
    if conky_window == nil then return end

    if tonumber(conky_parse('${updates}')) <2  then return end
    local filepng = filename .. ".png"
    local actual_time  = os.time()
   
    if last_time == nil then last_time=0 end
    local actual_img = io.open(filepng,"r")   
    if  last_time+period < actual_time or last_time == 0 or actual_img == nil then
        print ('convert image ' .. filename)
        convert_square(filename,filepng,radius,angle,radius_crop)
        last_time=actual_time
    end
    crop_square_to_round(filepng,xc,yc,radius)
    io.close()
end


--[[END OF SQUARE TO ROUND WIDGET]]

function conky_main(filename)
    if conky_window == nil then return end
    display_round(filename,
                275,275,120,  --xc,yc,radius
                5,            --angle
                98,           --radius_crop (1-100)
                3600        --period
    )
end



conkyrc en bas à droite

Code : Tout sélectionner

 
background no
use_xft yes
xftfont GE Inspira:size=10
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_argb_visual yes
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager
double_buffer yes
minimum_size 350
maximum_width 350
text_buffer_size 1024
draw_shades no
draw_outline no
draw_borders no
border_width 1
draw_graph_borders no
default_color gray10
default_outline_color cacaca
alignment tr
gap_x 20
gap_y 500
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
color1 62891A
color2 gray
color3 gray30
color4 gray30
color5 gray30
color6 gray30
color7 gray30
color8 Forestgreen
color9 white

TEXT
${font webdings: size=15}${if_match ${memperc} >0}${color6}${else}${color2}${endif}=${if_match ${memperc} >10}${color6}${else}${color2}${endif}=${if_match ${memperc} >20}${color5}${else}${color2}${endif}=${if_match ${memperc} >30}${color5}${else}${color2}${endif}=${if_match ${memperc} >40}${color4}${else}${color2}${endif}=${if_match ${memperc} >50}${color4}${else}${color2}${endif}=${if_match ${memperc} >60}${color3}${else}${color2}${endif}=${if_match ${memperc} >70}${color3}${else}${color2}${endif}=${if_match ${memperc} >80}${color1}${else}${color2}${endif}=${if_match ${memperc} >90}${color1}${else}${color2}${endif}=${font}${color} $mem/$memmax ${goto 235}mem ${goto 262}: ${color5}${top_mem name 1}${color}${goto 291}
${font webdings: size=15}${if_match ${cpu} >0}${color6}${else}${color2}${endif}=${if_match ${cpu} >10}${color6}${else}${color2}${endif}=${if_match ${cpu} >20}${color5}${else}${color2}${endif}=${if_match ${cpu} >30}${color5}${else}${color2}${endif}=${if_match ${cpu} >40}${color4}${else}${color2}${endif}=${if_match ${cpu} >50}${color4}${else}${color2}${endif}=${if_match ${cpu} >60}${color3}${else}${color2}${endif}=${if_match ${cpu} >70}${color3}${else}${color2}${endif}=${if_match ${cpu} >80}${color1}${else}${color2}${endif}=${if_match ${cpu} >90}${color1}${else}${color2}${endif}=${font}${color} ${cpu cpu0}%  ${goto 235}cpu ${goto 262}: ${color5}${top name 1}${color}${goto 291}
${font webdings: size=15}${if_match ${fs_used_perc /} >0}${color6}${else}${color2}${endif}=${if_match ${fs_used_perc /} >10}${color6}${else}${color2}${endif}=${if_match ${fs_used_perc /} >20}${color5}${else}${color2}${endif}=${if_match ${fs_used_perc /} >30}${color5}${else}${color2}${endif}=${if_match ${fs_used_perc /} >40}${color4}${else}${color2}${endif}=${if_match ${fs_used_perc /} >50}${color4}${else}${color2}${endif}=${if_match ${fs_used_perc /} >60}${color3}${else}${color2}${endif}=${if_match ${fs_used_perc /} >70}${color3}${else}${color2}${endif}=${if_match ${fs_used_perc /} >80}${color3}${else}${color2}${endif}=${if_match ${fs_used_perc /} >90}${color1}${else}${color2}${endif}=${font}${color} ${fs_used_perc /}%${goto 220}${fs_used /} / ${fs_size /} ${goto 300} Racine
Fréquences: ${alignr}n°1: ${color3}${freq_g 1}GHz   ${color}n°2: ${color3}${freq_g 2}GHz   ${color}n°3: ${color3}${freq_g 3}GHz   ${color}n°4: ${color3}${freq_g 4}GHz $color
Charge:  $cpu% ${cpubar 6,140}$alignr ${cpugraph 6,135 gray30 gray30}
Température: ${color3}${execi 300 sensors | grep Physical | cut -c18-24} $alignr${color} Tâches en cours: ${color3}${running_threads}$color

kernel:${goto 171}${color3}${kernel}$color
loadaverage:${goto 171}${color3}${loadavg 1} ${loadavg 2} ${loadavg 3}$color
uptime:${goto 171}${color3}${uptime}$color
hdd: ${goto 171}${color3}${hddtemp /dev/sda}°C $color Carte: ${color3}${hwmon temp 1}°C $color
batterie ${battery BAT0}
${goto 171}${color5}$stippled_hr${color}${if_existing /proc/net/route wlp2s0}
wifi:${goto 171}${color3}" ${wireless_essid wlp2s0} "$color
essid quality:${goto 171}${color3}${wireless_bitrate wlp2s0}${goto 291}${wireless_link_qual_perc wlp2s0}%$color
entrant:${goto 117}${color3}${downspeed wlp2s0}$color${goto 171}total entré:${color3}${goto 291}${totaldown wlp2s0}$color
sortant:${goto 117}${color3}${upspeed wlan0}$color${goto 171}total sorti:${goto 291}${color3}${totalup wlp2s0} $color
${goto 171}local IP:${goto 291}${color3}${addr wlp2s0}$color
${goto 171}public IP:${goto 289}${color3}${execi 1800 ~/.conky/v11/conky/ip.sh}$color
${goto 171}${color5}$stippled_hr${color}
vnstat${goto 100}aujourd'hui ${goto 169} ${execi 60 vnstat -i wlp2s0 --oneline | cut -d\; -f8}${goto 291}total
sortant ${color3}#
${goto 100}${execi 60 vnstat -i wlp2s0 --oneline | cut -d\; -f5}#
${goto 172}${execi 60 vnstat -i wlp2s0 --oneline | cut -d\; -f10}#
${goto 291}${execi 60 vnstat -i wlp2s0 --oneline | cut -d\; -f14}$color
entrant ${color3}#
${goto 100}${execi 60 vnstat -i wlp2s0 --oneline | cut -d\; -f4}#
${goto 172}${execi 60 vnstat -i wlp2s0 --oneline | cut -d\; -f9}#
${goto 291}${execi 60 vnstat -i wlp2s0 --oneline | cut -d\; -f13}$color
total ${color3}#
${goto 100}${execi 60 vnstat -i wlp2s0 --oneline | cut -d\; -f6}#
${goto 172}${execi 60 vnstat -i wlp2s0 --oneline | cut -d\; -f11}#
${goto 291}${execi 60 vnstat -i wlp2s0 --oneline | cut -d\; -f15}$color
${endif}
${if_existing /proc/net/route eth0}
wlan:${goto 117}
download:${goto 117}${downspeed eth0}${goto 170} total download:${goto 291}${totaldown eth0}
upload:${goto 117}${upspeed eth0}${goto 170} total upload:${goto 291}${totalup eth0}
${goto 170} local IP:${goto 291}${addr eth0}
${goto 170} public IP:${goto 289}${execi 1800 ~/.conky/ip.sh}
${goto 171}${color5}$stippled_hr${color}
vnstat${goto 100}today ${goto 169} ${execi 60 vnstat -i eth0 --oneline | cut -d\; -f8}${goto 291}total
up#
${goto 100}${execi 60 vnstat -i eth0 --oneline | cut -d\; -f5}#
${goto 172}${execi 60 vnstat -i eth0 --oneline | cut -d\; -f10}#
${goto 291}${execi 60 vnstat -i eth0 --oneline | cut -d\; -f14}
down#
${goto 100}${execi 60 vnstat -i eth0 --oneline | cut -d\; -f4}#
${goto 172}${execi 60 vnstat -i eth0 --oneline | cut -d\; -f9}#
${goto 291}${execi 60 vnstat -i eth0 --oneline | cut -d\; -f13}
total#
${goto 100}${execi 60 vnstat -i eth0 --oneline | cut -d\; -f6}#
${goto 172}${execi 60 vnstat -i eth0 --oneline | cut -d\; -f11}#
${goto 291}${color5}${execi 60 vnstat -i eth0 --oneline | cut -d\; -f15}
${endif}



Pour la meteo c'est le pack wunderground_API à prendre sur le forum bunsenlabs
meteo

Code : Tout sélectionner

background yes
use_xft yes
xftfont  GE Inspira:size=10 #URW Chancery L:style=Bold:size=10 monofur:bold pour ←↓→↑
xftalpha 1
imlib_cache_size 0
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_argb_visual yes
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager
double_buffer yes
minimum_size 350
maximum_width 350
text_buffer_size 2048
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color gray30 #ffd579
default_outline_color white
alignment top_right
gap_x 390
gap_y 570
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes

lua_load ~/.conky/lua/image.lua
 
 
 TEXT
 
${execi 1800 bash $HOME/1_accuweather/1_accuweather -f2015 -h2015}${execi 1800 bash $HOME/2b_Wunderground_API/2b}
${voffset -32}${goto 90}${font GE Inspira:size=12}Sarreguemines , MO , France${font}$color
${goto 104}Station  ${execi 600  sed -n '34p' $HOME/2b_Wunderground_API/Conditions} - ${execi 600  sed -n '45p' $HOME/2b_Wunderground_API/Conditions}
${goto 90}Dernière mise à jour : ${execi 600  sed -n '53p' $HOME/2b_Wunderground_API/Conditions-fr | cut -c18-22}
### conditions actuelles + Cette nuit et aujourd'hui ####
${goto 40}${voffset 10}Condition                                                                                                                               ${goto 240} ${execi 600 sed -n '1p' $HOME/1_accuweather/first_days}
${goto 30}${execi 90 sed -n '2p' $HOME/1_accuweather/curr_cond} °C ± ${execi 90 sed -n '3p' $HOME/1_accuweather/curr_cond} °C                                  ${goto 260}${execi 600 sed -n '3p' $HOME/1_accuweather/first_days}°C
${goto 15}${execi 600 sed -n '4p' $HOME/1_accuweather/curr_cond}                                                                                               ${goto 220}${execi 600 sed -n '5p' $HOME/1_accuweather/first_days}
${goto 30}${execi 600 sed -n '5p' $HOME/1_accuweather/curr_cond} à ${execi 90 sed -n '7p' $HOME/1_accuweather/curr_cond}                                       ${goto 230}${execi 600  sed -n '98p' $HOME/2b_Wunderground_API/Simple_Forecast}  à  ${execi 600  sed -n '96p' $HOME/2b_Wunderground_API/Simple_Forecast}km/h
#### demain + après demain ####
${goto 40}${voffset 40} Demain                                                                                                                                 ${goto 234}Après-demain                                 
${goto 30}${execi 600 sed -n '9p' $HOME/1_accuweather/first_days} - ${execi 600 sed -n '8p' $HOME/1_accuweather/first_days}°C                                  ${goto 252}${execi 600 sed -n '14p' $HOME/1_accuweather/first_days} - ${execi 600 sed -n '13p' $HOME/1_accuweather/first_days}°C
${goto 15}${execi 600 sed -n '10p' $HOME/1_accuweather/first_days}                                                                                             ${goto 220}${execi 600 sed -n '15p' $HOME/1_accuweather/first_days}
${goto 30}${execi 600  sed -n '204p' $HOME/2b_Wunderground_API/Simple_Forecast}  à  ${execi 600  sed -n '202p' $HOME/2b_Wunderground_API/Simple_Forecast}km/h  ${goto 230}${execi 600  sed -n '310p' $HOME/2b_Wunderground_API/Simple_Forecast}  à  ${execi 600  sed -n '308p' $HOME/2b_Wunderground_API/Simple_Forecast}km/h
#### icones ####
${lua fDrawImage $HOME/1_accuweather/forecast_2015/forecast_0.png  32  96 70 40}\
${lua fDrawImage $HOME/1_accuweather/forecast_2015/forecast_1.png 234  96 70 40}\
${lua fDrawImage $HOME/1_accuweather/forecast_2015/forecast_2.png  32 196 70 40}\
${lua fDrawImage $HOME/1_accuweather/forecast_2015/forecast_3.png 234 196 70 40}\



image couverture nuageuse
nuage

Code : Tout sélectionner

background no
use_xft yes
xftfont URW Chancery L:style=Bold:size=10
xftalpha 1
update_interval 1
total_run_times 0
own_window yes
own_window_transparent yes
own_window_argb_visual yes
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager
double_buffer yes
minimum_size 250 250
maximum_width 250
text_buffer_size 2048
draw_shades no
draw_outline no
draw_borders no
border_width 1
draw_graph_borders no
default_color ffffff
default_outline_color cacaca
alignment tl
gap_x 620
gap_y 590
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
#
color1                ffff00

lua_load ~/.conky/lua/image.lua

TEXT
${execi 300 ~/.conky/v11/scripts/couvnuage.sh}
${lua fDrawImage /home/loutch/.conky/v11/nuage/nuage.png 0 0 250 250 0}


nuage.sh

Code : Tout sélectionner

#!/bin/bash

# Crée par JPDipsy
# script de recupération imagesat couverture nuageuse http://www.sat24.com
# et mise en forme polaroïd imagemagick et pagecurl  doivent être installés
# ce script et le script pagecurl doivent être dans le même rep.
#----------------------------------------------------------------------------------`
# ce que vous voulez
path=`dirname $0`
heuremodif=`date +%H`; minmodif=`date +%M`
fonte=Ubuntu
nomimage=nuage
tailleimage=100 # ceci est en pourcentage
tailledecoupe=180x180
rotation=0
libelle="Mise à jour : "

wget -q -O  ~/.conky/v11/nuage/$nomimage.gif "http://www.sat24.com/image.ashx?country=eu&type=zoom&format=640x480001001&rnd=610703"

function mise_en_forme_image {
convert  ~/.conky/v11/nuage/$nomimage.png \
-fill white -font $fonte -pointsize 16 -annotate 0x0+10+274 "$libelle $heuremodif h $minmodif" ~/.conky/v11/nuage/$nomimage.png
\( +clone  -alpha extract \
        -draw 'fill black polygon 0,0 0,15 15,0 fill white circle 0,15 15,0' \
        \( +clone -flip \) -compose Multiply -composite \
        \( +clone -flop \) -compose Multiply -composite \
     \) -alpha off -compose CopyOpacity -composite  ~/.conky/v11/nuage/$nomimage.png
     
}


function ombre {
convert   ~/.conky/v11/nuage/$nomimage.png  -background  black  \( +clone -shadow 60x4+2+2 \) +swap -background  none   -flatten ~/.conky/v11/nuage/$nomimage.png   
}   

if [[ -e ~/.conky/v11/nuage/$nomimage.gif ]] ; then
   # decoupage de la partie utile
   convert ~/.conky/v11/nuage/$nomimage.gif -filter Lanczos -crop  $tailledecoupe+240+290\! ~/.conky/v11/nuage/$nomimage.png
   mise_en_forme_image ; ombre ; rm ~/.conky/v11/nuage/$nomimage.gif
else
   # comme ça votre conky aura toujours une image au cas ou
   convert -size $tailledecoupe plasma:  ~/.conky/v11/nuage/$nomimage.png
   libelle="Désolé pas d'image radar à "
   mise_en_forme_image ; ombre
fi
 




Voili

@+
HP Pavilion g 7 1357 sf
Multiboot 7-Mageia 5 KDE - Serena Cinnamon - Sarah XFCE


Retourner vers « Personnalisation »

Qui est en ligne

Utilisateurs parcourant ce forum : Aucun utilisateur enregistré et 3 invités