pack-météo ici
https://forums.bunsenlabs.org/viewtopic.php?id=189
pack-cronograph ici
https://www.deviantart.com/hfcf/art/Conky-Cronograph-Station-278646771
conkyrc
Code TEXT :
conky.config = {
background = true,
use_xft = true,
font = 'hooge 05_53:size=6',
xftalpha = 1,
update_interval = 1.0,
total_run_times = 0,
net_avg_samples = 2,
own_window = true,
own_window_transparent = true,
--own_window_color 000000
own_window_argb_visual = true,
--own_window_argb_value = 250,
own_window_type = 'normal',
own_window_hints = 'undecorated,below,skip_taskbar,skip_pager',
double_buffer = true,
minimum_width = 320, minimum_height = 320,
maximum_width = 320,
text_buffer_size = 2048,
draw_shades = false,
draw_outline = false,
draw_borders = false,
draw_graph_borders = false,
default_color = 'white',
default_outline_color = 'white',
alignment = 'top_right',
gap_x = 120,
gap_y = 70,
no_buffers = true,
uppercase = false,
cpu_avg_samples = 2,
override_utf8_locale = true,
imlib_cache_flush_interval = 60,
imlib_cache_size = 10000,
stippled_borders = 5,
-- Couleurs
default_color = '#ffffff', --ffd579
default_shade_color = '#333333',
default_outline_color = 'black',
color0 = 'white',
color1 = 'orange',
color2 = 'green',
color3 = '#000000',
color4 = '#FF0000',
color5 = '#696969',
color6 = '#BDB76B',
color7 = '#00FF01',
color8 = '#cccccc',
lua_load = '~/.conky/cronograph/scripts/cups.lua',
lua_draw_hook_post = 'main',
};
conky.text = [[
${execi 3600 bash $HOME/1_accuweather/1_accuweather -f2016}
${voffset 85}${goto 85}${font hooge 05_53:size=12}${time %H:%M}${font}${goto 215}UPTIME:
${voffset 2}${goto 72}${time %a %d %b}${goto 215}${uptime}
${voffset 2}${goto 90}${time %Y}${alignc -75}Temp.${hwmon 0 temp 1}°C
${voffset 84}${goto 75}Signal: ${wireless_link_qual_perc wlo1} %
${voffset -60}${goto 146}${font conkyweather:size=34}${execi 600 sed -n '22p' $HOME/1_accuweather/curr_cond}${font}
${voffset -60}${goto 154}${font hooge 05_53:size=12}${execpi 600 sed -n '2p' ~/1_accuweather/curr_cond}°C${font}
${voffset -16}${goto 200}${execpi 600 sed -n '4p' ~/1_accuweather/curr_cond | cut -c1-14}
${goto 200}${execpi 600 sed -n '4p' ~/1_accuweather/curr_cond | cut -c15-30}
${goto 200}Vent: ${execpi 600 sed -n '5p' ~/1_accuweather/curr_cond} ${execpi 600 sed -n '6p' ~/1_accuweather/curr_cond}
${goto 200}Hum: ${execpi 600 sed -n '7p' ~/1_accuweather/curr_cond}
${voffset -3}${font conkyweather:size=20}${goto 230}${execi 600 sed -n '27p' $HOME/1_accuweather/first_days}${font}
${voffset 1}${goto 220}${execi 600 sed -n '9p' $HOME/1_accuweather/first_days}°C - ${execi 600sed -n '8p' $HOME/1_accuweather/first_days}°C
${goto 225}${execi 3600 echo `date --date="1 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="1 day" | awk '{print $2}'`}\
${voffset -10}${font conkyweather:size=20}
${goto 90}${execi 600 sed -n '28p' $HOME/1_accuweather/first_days}
${voffset -34}${goto 226}${execi 600 sed -n '29p' $HOME/1_accuweather/first_days}${font}
${voffset -1}
${goto 80}${execi 600 sed -n '14p' $HOME/1_accuweather/first_days}°C - ${execi 600 sed -n '13p' $HOME/1_accuweather/first_days}°C\
${goto 215}${execi 600 sed -n '19p' $HOME/1_accuweather/first_days}°C - ${execi 600 sed -n '18p' $HOME/1_accuweather/first_days}°C
${goto 80}${execi 3600 echo `date --date="2 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="2 day" | awk '{print $2}'`}\
${goto 215}${execi 3600 echo `date --date="3 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="3 day" | awk '{print $2}'`}
${execpi 1 cat ~/.conky/cronograph/scripts/blinkingLED}
]];
conkyrc1 (pour le deuxième lua)
Code TEXT :
conky.config = {
background = true,
use_xft = true,
font = 'hooge 05_53:size=6',
xftalpha = 1,
update_interval = 1.0,
total_run_times = 0,
net_avg_samples = 2,
own_window = true,
own_window_transparent = true,
--own_window_color 000000
own_window_argb_visual = true,
--own_window_argb_value = 250,
own_window_type = 'normal',
own_window_hints = 'undecorated,below,skip_taskbar,skip_pager',
double_buffer = true,
minimum_width = 320, minimum_height = 320,
maximum_width = 320,
text_buffer_size = 2048,
draw_shades = false,
draw_outline = false,
draw_borders = false,
draw_graph_borders = false,
default_color = 'white',
default_outline_color = 'white',
alignment = 'top_right',
gap_x = 120,
gap_y = 70,
no_buffers = true,
uppercase = false,
cpu_avg_samples = 2,
override_utf8_locale = true,
imlib_cache_flush_interval = 60,
imlib_cache_size = 10000,
stippled_borders = 5,
-- Couleurs
default_color = '#ffffff', --ffd579
default_shade_color = '#333333',
default_outline_color = 'black',
color0 = 'white',
color1 = 'orange',
color2 = 'green',
color3 = '#000000',
color4 = '#FF0000',
color5 = '#696969',
color6 = '#BDB76B',
color7 = '#00FF01',
color8 = '#cccccc',
lua_load = '~/.conky/cronograph/scripts/clock_rings2a.lua',
lua_draw_hook_pre = 'clock_rings',
};
conky.text = [[
]];
cups.lua
Code TEXT : ---
--==============================================================================
-- Cups and Saucers
-- Lua conky script
--
-- author : Abu Yahya
-- license : Distributed under the terms of GNU GPL v3
-- 30.05.2012
-- v.1.0.1
--==============================================================================
require 'cairo'
--------------------------------------------------------------------------------
----Adjustable Settings
coffee_table = {
{
name='time', arg='%I', max_value=12,
x=170, y=170,
cup_radius=35,
cup_wall_thickness=90,
cup_bg_clr=0xffffff, cup_bg_alpha=0.0,
cup_fg_clr=0xFFFFFF, cup_fg_alpha=0.0,
handle_length=70, handle_circ=5,
handle_fg_clr=0xFFFFFF, handle_fg_alpha=0.0, --1.0
graduation_radius=124,
graduation_thickness=8, graduation_mark_circ=1.5,
graduation_mark_angle=30,
graduation_fg_clr=0xFFFFFF, graduation_fg_alpha=0.5,
saucer_thickness=6, thick_saucer_circ=11/12,
saucer_radius=135, thin_saucer_circ=11/12,
saucer_fg_clr=0xFFFFFF, saucer_fg_alpha=0.3,
saucer_mark_fg_clr=0xFFFFFF, saucer_mark_fg_alpha=0.0,
inner_saucer=true,
txt_weight=0, txt_size=8.0,
txt_fg_clr=0xFFFFFF, txt_fg_alpha=0.0,
caption='', caption2='',
},
{
name='time', arg='%H', max_value=12,
x=170, y=170,
cup_radius=2.5,
cup_wall_thickness=3,
cup_bg_clr=0xffffff, cup_bg_alpha=1.0,
cup_fg_clr=0xFFFFFF, cup_fg_alpha=1.0,
handle_length=40, handle_circ=4,
handle_fg_clr=0xFFFFFF, handle_fg_alpha=0.0, --1.0
graduation_radius=127,
graduation_thickness=1, graduation_mark_circ=0.5,
graduation_mark_angle=3,
graduation_fg_clr=0xFFFFFF, graduation_fg_alpha=0.5,
saucer_thickness=6, thick_saucer_circ=11/12,
saucer_radius=135, thin_saucer_circ=11/12,
saucer_fg_clr=0xFFFFFF, saucer_fg_alpha=0.0,
saucer_mark_fg_clr=0xFFFFFF, saucer_mark_fg_alpha=0.0,
inner_saucer=true,
txt_weight=0, txt_size=8.0,
txt_fg_clr=0xFFFFFF, txt_fg_alpha=0.0,
caption='', caption2='',
},
{
name='time', arg='%M', max_value=60,
x=170, y=170,
cup_radius=55,
cup_wall_thickness=120,
cup_bg_clr=0xffffff, cup_bg_alpha=0.0,
cup_fg_clr=0xFFFFFF, cup_fg_alpha=0.0,
graduation_radius=123,
graduation_thickness=10, graduation_mark_circ=2.5,
graduation_mark_angle=90,
graduation_fg_clr=0xFFFFFF, graduation_fg_alpha=0.5,
handle_length=110, handle_circ=3,
handle_fg_clr=0xFFFFFF, handle_fg_alpha=0.0, --1.0
saucer_thickness=6, thick_saucer_circ=11/12,
saucer_radius=155, thin_saucer_circ=11/12,
saucer_fg_clr=0xFFFFFF, saucer_fg_alpha=0.3,
saucer_mark_fg_clr=0xFFFFFF, saucer_mark_fg_alpha=0.0,
txt_weight=0, txt_size=8.0,
txt_fg_clr=0xFFFFFF, txt_fg_alpha=0.0,
caption='', caption2='',
},
{
name='time', arg='%S', max_value=60,
x=170, y=170,
cup_radius=59,
cup_wall_thickness=120,
cup_bg_clr=0xffffff, cup_bg_alpha=0.0,
cup_fg_clr=0xFFFFFF, cup_fg_alpha=0.0,
handle_fg_clr=0xFFFFFF, handle_fg_alpha=0.0, --1.0
handle_length=118, handle_circ=1,
graduation_radius=125,
graduation_thickness=6, graduation_mark_circ=0.5,
graduation_mark_angle=6,
graduation_fg_clr=0xFFFFFF, graduation_fg_alpha=0.5,
saucer_thickness=5, thick_saucer_circ=1,
saucer_radius=145, thin_saucer_circ=11/12,
saucer_fg_clr=0xFFFFFF, saucer_fg_alpha=0.4,
saucer_mark_fg_clr=0xFFFFFF, saucer_mark_fg_alpha=0.4,
txt_weight=0, txt_size=8.0,
txt_fg_clr=0xFFFFFF, txt_fg_alpha=0.0,
caption='', caption2='',
},
{
name='cpu', arg='cpu0', max_value=100,
x=170, y=100,
cup_radius=20,
cup_wall_thickness=40,
cup_start_angle=0,
cup_bg_clr=0xFFFFFF, cup_bg_alpha=0.0,
cup_fg_clr=0xFFFFFF, cup_fg_alpha=0.0,
handle_fg_clr=0xFFFFFF, handle_fg_alpha=0.0,
handle_length=40, handle_circ=4,
xtxt=-20, ytxt= -5,
txt_weight=0, txt_size=8.0,
txt_fg_clr=0xFFFFFF, txt_fg_alpha=1,
caption=' CPU ', caption2=' %',
graduation_radius=25,
graduation_thickness=3, graduation_mark_circ=2,
graduation_mark_angle=36,
graduation_fg_clr=0xFFFFFF, graduation_fg_alpha=0.6,
saucer_thickness=3, thick_saucer_circ=0.85,
saucer_radius=30, thin_saucer_circ=0.85,
saucer_fg_clr=0xFFFFFF, saucer_fg_alpha= 0.3,
saucer_mark_fg_clr=0xFFFFFF, saucer_mark_fg_alpha=0.5,
inner_saucer=true,
},
{
name='freq_g', arg='/', max_value=5,
x=170, y=100,
cup_radius=12,
cup_wall_thickness=23,
cup_start_angle=0,
cup_bg_clr=0xFFFFFF, cup_bg_alpha=0.0,
cup_fg_clr=0xFFFFFF, cup_fg_alpha=0.0,
handle_fg_clr=0xFFFFFF, handle_fg_alpha=0.0,
handle_length=40, handle_circ=4,
xtxt=-20, ytxt= 10,
txt_weight=0, txt_size=8.0,
txt_fg_clr=0xFFFFFF, txt_fg_alpha=1,
caption='', caption2=' GHz',
graduation_radius=25,
graduation_thickness=4, graduation_mark_circ=4,
graduation_mark_angle=30,
graduation_fg_clr=0xFFFFFF, graduation_fg_alpha=0.0,
saucer_thickness=3, thick_saucer_circ=0.75,
saucer_radius=35, thin_saucer_circ=0.75,
saucer_fg_clr=0xFFFFFF, saucer_fg_alpha= 0.3,
saucer_mark_fg_clr=0xFFFFFF, saucer_mark_fg_alpha=0.5,
},
---------------1/2
{
name='downspeedf', arg='wlo1', max_value=100,
x=100, y=170,
cup_radius=12,
cup_wall_thickness=23,
cup_start_angle=0,
cup_bg_clr=0xFFFFFF, cup_bg_alpha=0.0,
cup_fg_clr=0xFFFFFF, cup_fg_alpha=0.0,
handle_fg_clr=0xFFFFFF, handle_fg_alpha=0.0,
handle_length=40, handle_circ=4,
xtxt=-20, ytxt= -5,
txt_weight=0, txt_size=8.0,
txt_fg_clr=0xFFFFFF, txt_fg_alpha=1,
caption='E. ', caption2='',
graduation_radius=25,
graduation_thickness=3, graduation_mark_circ=2,
graduation_mark_angle=36,
graduation_fg_clr=0xFFFFFF, graduation_fg_alpha=0.6,
saucer_thickness=3, thick_saucer_circ=0.85,
saucer_radius=30, thin_saucer_circ=0.85,
saucer_fg_clr=0xFFFFFF, saucer_fg_alpha= 0.3,
saucer_mark_fg_clr=0xFFFFFF, saucer_mark_fg_alpha=0.5,
inner_saucer=true,
},
{
name='upspeedf', arg='wlo1', max_value=100,
x=100, y=170,
cup_radius=12,
cup_wall_thickness=27,
cup_start_angle=0,
cup_bg_clr=0xFFFFFF, cup_bg_alpha=0.0,
cup_fg_clr=0xFFFFFF, cup_fg_alpha=0.0,
handle_fg_clr=0xFFFFFF, handle_fg_alpha=0.0,
handle_length=40, handle_circ=4,
xtxt=-20, ytxt= 10,
txt_weight=0, txt_size=8.0,
txt_fg_clr=0xFFFFFF, txt_fg_alpha=1,
caption='S ', caption2='',
graduation_radius=25,
graduation_thickness=4, graduation_mark_circ=4,
graduation_mark_angle=30,
graduation_fg_clr=0xFFFFFF, graduation_fg_alpha=0.0,
saucer_thickness=3, thick_saucer_circ=0.85,
saucer_radius=35, thin_saucer_circ=0.85,
saucer_fg_clr=0xFFFFFF, saucer_fg_alpha=0.3,
saucer_mark_fg_clr=0xFFFFFF, saucer_mark_fg_alpha=0.5,
},
------------------2/3
{
name='fs_used_perc', arg='/home', max_value=100,
x=170, y=240,
cup_radius=12,
cup_wall_thickness=27,
cup_start_angle=0,
cup_bg_clr=0xFFFFFF, cup_bg_alpha=0.0,
cup_fg_clr=0xFFFFFF, cup_fg_alpha=0.0,
handle_fg_clr=0xFFFFFF, handle_fg_alpha=0.0,
handle_length=40, handle_circ=4,
xtxt=-20, ytxt= 10,
txt_weight=0, txt_size=8.0,
txt_fg_clr=0xFFFFFF, txt_fg_alpha=1,
caption=' FS /: ', caption2=' %',
graduation_radius=25,
graduation_thickness=3, graduation_mark_circ=2,
graduation_mark_angle=36,
graduation_fg_clr=0xFFFFFF, graduation_fg_alpha=0.6,
saucer_thickness=3, thick_saucer_circ=0.85,
saucer_radius=30, thin_saucer_circ=0.85,
saucer_fg_clr=0xFFFFFF, saucer_fg_alpha=0.3,
saucer_mark_fg_clr=0xFFFFFF, saucer_mark_fg_alpha=0.5,
inner_saucer=true,
},
{
name='fs_used_perc', arg='/', max_value=100,
x=170, y=240,
cup_radius=12,
cup_wall_thickness=27,
cup_start_angle=0,
cup_bg_clr=0xFFFFFF, cup_bg_alpha=0.0,
cup_fg_clr=0xFFFFFF, cup_fg_alpha=0.0,
handle_fg_clr=0xFFFFFF, handle_fg_alpha=0.0,
handle_length=40, handle_circ=4,
xtxt=-20, ytxt= -5,
txt_weight=0, txt_size=8.0,
txt_fg_clr=0xFFFFFF, txt_fg_alpha=0.8,
caption=' FS H: ', caption2=' %',
graduation_radius=25,
graduation_thickness=4, graduation_mark_circ=4,
graduation_mark_angle=36,
graduation_fg_clr=0xFFFFFF, graduation_fg_alpha=0.0,
saucer_thickness=3, thick_saucer_circ=0.85,
saucer_radius=35, thin_saucer_circ=0.85,
saucer_fg_clr=0xFFFFFF, saucer_fg_alpha=0.3,
saucer_mark_fg_clr=0xFFFFFF, saucer_mark_fg_alpha=0.5,
},
}
--Fixed code -do not edit unless you know what you are doing------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- converts color in hexa to decimal
function rgb_to_r_g_b(clr, alpha)
return ((clr / 0x10000) % 0x100) / 255., ((clr / 0x100) % 0x100) / 255., (clr % 0x100) / 255., alpha
end
-------------------------------------------------------------------------------
------------------------------------------------------------------------
-- displays cups and saucers
local function draw_coffee_table(display, data, value)
max_value = data['max_value']
x, y = data['x'], data['y']
if x==nil then x=conky_window.width/2 end
if y==nil then y=conky_window.height/2 end
cup_radius = data['cup_radius']
if cup_radius==nil then cup_radius=conky_window.width/4 end
cup_wall_thickness = data['cup_wall_thickness']
if cup_wall_thickness==nil then cup_wall_thickness=20 end
handle_length, handle_circ = data['handle_length'], data['handle_circ']
if handle_length==nil then handle_length=20 end
if handle_circ==nil then handle_circ=1 end
cup_start_angle = data['cup_start_angle']
if cup_start_angle == nil then cup_start_angle =0 end
total_angle = data['total_angle']
if total_angle == nil then total_angle=360 end
cup_sector_angle = (math.abs(total_angle))/max_value
cup_end_angle = total_angle + cup_start_angle
cup_bg_clr, cup_bg_alpha = data['cup_bg_clr'], data['cup_bg_alpha']
if cup_bg_clr==nil then cup_bg_clr =0xffffff end
cup_fg_clr, cup_fg_alpha = data['cup_fg_clr'], data['cup_fg_alpha']
if cup_fg_clr==nil then cup_fg_clr =0xffffff end
if cup_fg_alpha==nil then cup_fg_alpha=0 end
handle_fg_clr, handle_fg_alpha = data['handle_fg_clr'], data['handle_fg_alpha']
if handle_fg_clr==nil then handle_fg_clr = 0xffffff end
if handle_fg_alpha==nil then handle_fg_alpha=0 end
saucer_radius = data['saucer_radius']
if saucer_radius==nil then saucer_radius=conky_window.width/2 end
total_saucer_angle=data['total_saucer_angle']
if total_saucer_angle==nil then total_saucer_angle=360 end
saucer_sector_angle=(math.abs(total_saucer_angle))/max_value
saucer_thickness = data['saucer_thickness']
if saucer_thickness==nil then saucer_thickness=6 end
saucer_fg_clr = data['saucer_fg_clr']
if saucer_fg_clr ==nil then saucer_fg_clr=0 end
saucer_fg_alpha = data['saucer_fg_alpha']
if saucer_fg_alpha ==nil then saucer_fg_alpha=0 end
saucer_mark_fg_alpha = data['saucer_mark_fg_alpha']
if saucer_mark_fg_alpha ==nil then saucer_mark_fg_alpha=0 end
saucer_mark_fg_clr = data['saucer_mark_fg_clr']
if saucer_mark_fg_clr ==nil then saucer_mark_fg_clr=0xffffff end
thick_saucer_circ = data['thick_saucer_circ']
if thick_saucer_circ==nil then thick_saucer_circ =0.9 end
thin_saucer_circ = data['thin_saucer_circ']
if thin_saucer_circ==nil then thin_saucer_circ =0.9 end
inner_saucer = data['inner_saucer']
graduation_radius = data['graduation_radius']
if graduation_radius ==nil then graduation_radius = conky_window.width/3 end
graduation_thickness, graduation_mark_circ = data['graduation_thickness'], data['graduation_mark_circ']
if graduation_thickness ==nil then graduation_thickness = 2 end
if graduation_mark_circ ==nil then graduation_mark_circ = 1 end
graduation_mark_angle = data['graduation_mark_angle']
if graduation_mark_angle == nil then graduation_mark_angle = total_angle/10 end
graduation_fg_clr, graduation_fg_alpha = data['graduation_fg_clr'], data['graduation_fg_alpha']
if graduation_fg_clr ==nil then graduation_fg_clr= 0xffffff end
if graduation_fg_alpha==nil then graduation_fg_alpha =0 end
txt_weight, txt_size = data['txt_weight'], data['txt_size']
if txt_weight == nil then txt_weight=1 end
if txt_size == nil then txt_size=8 end
txt_fg_clr, txt_fg_alpha = data['txt_fg_clr'], data['txt_fg_alpha']
if txt_fg_clr ==nil then txt_fg_clr= 0xffffff end
if txt_fg_alpha==nil then txt_fg_alpha =0 end
caption = data['caption']
if caption==nil then caption='' end
caption2 = data['caption2']
if caption2==nil then caption2='' end
xtxt, ytxt= data ['xtxt'], data['ytxt']
if xtxt ==nil then xtxt=0 end
if ytxt ==nil then ytxt=0 end
--convert degree to rad and rotate (0 degree is top/north)
function angle_to_position(start_angle, current_angle)
if total_angle < 0 then
local pos = start_angle - current_angle
return ( ( pos * (math.pi / 180) ) - (math.pi / 2) )
else
local pos = current_angle + start_angle
return ( ( pos * (math.pi / 180) ) - (math.pi / 2) )
end
end
--cup centre background
if cup_bg_alpha >0 then
if total_angle < 0 then
cairo_arc_negative(display, x, y, cup_radius, angle_to_position(cup_start_angle, 0), angle_to_position(cup_end_angle, 0))
else
cairo_arc(display, x, y, cup_radius, angle_to_position(cup_start_angle, 0), angle_to_position(cup_start_angle, cup_end_angle))
end
cairo_set_source_rgba(display, rgb_to_r_g_b(cup_bg_clr, cup_bg_alpha))
cairo_set_line_width(display, cup_wall_thickness)
cairo_stroke(display)
end
--cup wall fg
if cup_fg_alpha > 0 then
local fg_stop_arc = (cup_sector_angle * value)
if total_angle < 0 then
cairo_arc_negative(display, x, y, cup_radius, angle_to_position(cup_start_angle, 0), angle_to_position(cup_start_angle, fg_stop_arc))
else
cairo_arc(display, x, y, cup_radius, angle_to_position(cup_start_angle, 0), angle_to_position(cup_start_angle, fg_stop_arc))
end
cairo_set_source_rgba(display, rgb_to_r_g_b(cup_fg_clr, cup_fg_alpha))
cairo_set_line_width(display, cup_wall_thickness)
cairo_stroke(display)
end
-- cup handle
if handle_fg_alpha>0 then
local start_handle = (cup_sector_angle * value) - (handle_circ*0.5)
local stop_handle = (cup_sector_angle * value) + (handle_circ*0.5)
if total_angle < 0 then
cairo_arc_negative(display, x, y, cup_radius, angle_to_position(cup_start_angle, start_handle), angle_to_position(cup_start_angle, stop_handle))
else
cairo_arc(display, x, y, cup_radius, angle_to_position(cup_start_angle, start_handle), angle_to_position(cup_start_angle, stop_handle))
end
cairo_set_line_width(display, handle_length)
cairo_set_source_rgba(display, rgb_to_r_g_b(handle_fg_clr, handle_fg_alpha))
cairo_stroke(display)
end
--saucers
---thick saucer
if saucer_fg_alpha > 0 and (thin_saucer_circ >0 or thick_saucer_circ > 0)
then
if value < (max_value/2)
then j = value + ((max_value*total_saucer_angle)/720)
else j = value - ((max_value*total_saucer_angle)/720)
end
local start_saucer = (saucer_sector_angle * j) - (value*saucer_sector_angle*0.5*thick_saucer_circ)
local stop_saucer = (saucer_sector_angle * j) + (value*saucer_sector_angle*0.5*thick_saucer_circ)
if total_angle < 0 then
cairo_arc_negative(display, x, y, saucer_radius, angle_to_position(cup_start_angle, start_saucer), angle_to_position(cup_start_angle, stop_saucer))
else
cairo_arc(display, x, y, saucer_radius, angle_to_position(cup_start_angle, start_saucer), angle_to_position(cup_start_angle, stop_saucer))
end
cairo_set_source_rgba(display, rgb_to_r_g_b(saucer_fg_clr, saucer_fg_alpha))
cairo_set_line_width(display, saucer_thickness)
cairo_stroke(display)
--thin saucer
if inner_saucer == true
then rt = (saucer_radius - 0.5) + (0.5 * saucer_thickness)
else rt = (saucer_radius + 0.5) - (0.5 * saucer_thickness)
end
local start_thin_saucer = (saucer_sector_angle * j) - (max_value *0.5*saucer_sector_angle*thin_saucer_circ)
local stop_thin_saucer = (saucer_sector_angle * j) + (max_value *0.5*saucer_sector_angle*thin_saucer_circ)
if total_angle < 0 then
cairo_arc_negative(display, x, y, rt, angle_to_position(cup_start_angle, start_thin_saucer), angle_to_position(cup_start_angle, stop_thin_saucer))
else
cairo_arc(display, x, y, rt, angle_to_position(cup_start_angle, start_thin_saucer), angle_to_position(cup_start_angle, stop_thin_saucer))
end
cairo_set_source_rgba(display, rgb_to_r_g_b(saucer_fg_clr, saucer_fg_alpha))
cairo_set_line_width(display, 1)
cairo_stroke(display)
end
--saucer mark
if saucer_mark_fg_alpha > 0 then
local start_cm = (saucer_sector_angle * value) - (handle_circ *0.5 )
local stop_cm = (saucer_sector_angle * value) + (handle_circ *0.5 )
if total_angle < 0 then
cairo_arc_negative(display, x, y, saucer_radius, angle_to_position(cup_start_angle, start_cm), angle_to_position(cup_start_angle, stop_cm))
else
cairo_arc(display, x, y, saucer_radius, angle_to_position(cup_start_angle, start_cm), angle_to_position(cup_start_angle, stop_cm))
end
cairo_set_source_rgba(display, rgb_to_r_g_b(saucer_mark_fg_clr, saucer_mark_fg_alpha))
cairo_set_line_width(display, saucer_thickness)
cairo_stroke(display)
end
--graduation mark
if graduation_radius > 0 and graduation_thickness > 0 and graduation_mark_angle > 0 then
number_graduation = (math.abs(total_angle) +1)/ graduation_mark_angle
local start_arc_grad = 0
local stop_arc_grad = 0
local i = 0
while i < number_graduation do
local start_arc_grad = (graduation_mark_angle * (i)) - (graduation_mark_circ *0.5)
local stop_arc_grad = (graduation_mark_angle * (i)) + (graduation_mark_circ *0.5)
if total_angle < 0 then
cairo_arc_negative(display, x, y, graduation_radius, angle_to_position(cup_start_angle, start_arc_grad), angle_to_position(cup_start_angle, stop_arc_grad))
else
cairo_arc(display, x, y, graduation_radius, angle_to_position(cup_start_angle, start_arc_grad), angle_to_position(cup_start_angle, stop_arc_grad))
end
cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_clr,graduation_fg_alpha))
cairo_set_line_width(display, graduation_thickness)
cairo_stroke(display)
i = i + 1
end
end
-- text
if txt_fg_alpha>0 then
cairo_select_font_face (display, "hooge 05_53", CAIRO_FONT_SLANT_NORMAL, txt_weight);
cairo_set_font_size (display,txt_size)
cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_clr, txt_fg_alpha))
cairo_move_to (display,x+xtxt,y+ytxt)
cairo_show_text (display, caption ) cairo_show_text (display,value)cairo_show_text (display, caption2 )
cairo_stroke (display)
end
end
-------------------------------------------------------------------------------
-- loads data and displays table_settings
function display_coffee_table(display)
local function load_coffee_table(display, data)
local str, value = '', 0
if data['name'] == 'time2' then
local max_value = data['max_value']
str = string.format('${time %s}', data['arg'])
str = conky_parse(str)
local value2 = tonumber(str:sub(0,2))
if value2 == max_value then value2 = 0 end
value = value2 + (tonumber(str:sub(4,5))/60)
else
str = string.format('${%s %s}',data['name'], data['arg'])
str = conky_parse(str)
value = tonumber(str)
end
if value == nil then value = 0 end
draw_coffee_table(display, data, value)
end
for i in pairs(coffee_table) do
load_coffee_table(display, coffee_table[i])
end
end
-------------------------------------------------------------------------------
runscheck = 0 -- fix for draw shades running script twice on every update
function conky_main()
if conky_window == nil then
return
end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local display = cairo_create(cs)
local updates = conky_parse('${updates}')
update_num = tonumber(updates)
if update_num > 5 then
cairo_set_antialias (display, CAIRO_ANTIALIAS_SUBPIXEL)
display_coffee_table(display)
cairo_set_antialias (display, CAIRO_ANTIALIAS_DEFAULT)
end
cairo_surface_destroy(cs)
cairo_destroy(display)
end
clocks_rings.lua
Code TEXT : --[[
Clock Rings by londonali1010 (2009)
This script draws percentage meters as rings, and also draws clock hands if you want! It is fully customisable; all options are described in the script. This script is based off a combination of my clock.lua script and my rings.lua 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/clock_rings-v1.1.1.lua
lua_draw_hook_pre clock_rings
Changelog:
+ v1.1.1 -- Fixed minor bug that caused the script to crash if conky_parse() returns a nil value (20.10.2009)
+ v1.1 -- Added colour option for clock hands (07.10.2009)
+ v1.0 -- Original release (30.09.2009)
]]
settings_table = {
{
-- Edit this table to customise your rings.
-- You can create more rings simply by adding more elements to settings_table.
-- "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
name='time',
-- "arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''.
arg='%I',
-- "max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
max=12,
-- "bg_colour" is the colour of the base ring.
bg_colour=0xFFFFFF,
-- "bg_alpha" is the alpha value of the base ring.
bg_alpha=0.0,
-- "fg_colour" is the colour of the indicator part of the ring.
fg_colour=0xFFFFFF,
-- "fg_alpha" is the alpha value of the indicator part of the ring.
fg_alpha=0.0,
-- "x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
x=150, y=150,
-- "radius" is the radius of the ring.
radius=133,
-- "thickness" is the thickness of the ring, centred around the radius.
thickness=4,
-- "start_angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative.
start_angle=0,
-- "end_angle" is the ending angle of the ring, in degrees, clockwise from top. Value can be either positive or negative, but must be larger than start_angle.
end_angle=360
},
{
name='time',
arg='%M',
max=60,
bg_colour=0xFFFFFF,
bg_alpha=0.0,
fg_colour=0xFFFFFF,
fg_alpha=0.0,
x=150, y=150,
radius=140,
thickness=4,
start_angle=0,
end_angle=360
},
{
name='time',
arg='%S',
max=60,
bg_colour=0xFFFFFF,
bg_alpha=0.0,
fg_colour=0xFFFFFF,
fg_alpha=0.0,
x=150, y=150,
radius=147,
thickness=4,
start_angle=0,
end_angle=360
},
}
-- Use these settings to define the origin and extent of your clock.
clock_r=127
-- "clock_x" and "clock_y" are the coordinates of the centre of the clock, in pixels, from the top left of the Conky window.
clock_x=170
clock_y=170
-- Colour & alpha of the clock hands
clock_colour=0xFFFFFF
clock_alpha=1
-- Do you want to show the seconds hand?
show_seconds=true
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 draw_clock_hands(cr,xc,yc)
local secs,mins,hours,secs_arc,mins_arc,hours_arc
local xh,yh,xm,ym,xs,ys
secs=os.date("%S")
mins=os.date("%M")
hours=os.date("%I")
secs_arc=(2*math.pi/60)*secs
mins_arc=(2*math.pi/60)*mins+secs_arc/60
hours_arc=(2*math.pi/12)*hours+mins_arc/12
-- Draw hour hand
xh=xc+0.7*clock_r*math.sin(hours_arc)
yh=yc-0.7*clock_r*math.cos(hours_arc)
cairo_move_to(cr,xc,yc)
cairo_line_to(cr,xh,yh)
cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
cairo_set_line_width(cr,5)
cairo_set_source_rgba(cr,rgb_to_r_g_b(clock_colour,clock_alpha))
cairo_stroke(cr)
-- Draw minute hand
xm=xc+clock_r*math.sin(mins_arc)
ym=yc-clock_r*math.cos(mins_arc)
cairo_move_to(cr,xc,yc)
cairo_line_to(cr,xm,ym)
cairo_set_line_width(cr,3)
cairo_stroke(cr)
-- Draw seconds hand
if show_seconds then
xs=xc+clock_r*math.sin(secs_arc)
ys=yc-clock_r*math.cos(secs_arc)
cairo_move_to(cr,xc,yc)
cairo_line_to(cr,xs,ys)
cairo_set_line_width(cr,1) -- (cr,1)
cairo_stroke(cr)
end
end
function conky_clock_rings()
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
-- Check that Conky has been running for at least 5s
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
setup_rings(cr,settings_table[i])
end
end
draw_clock_hands(cr,clock_x,clock_y)
end
blinkingLED
Code TEXT : ${image $HOME/.conky/cronograph/images/Blank.png -p 145, 32 -s 40x40}${if_match ${execi 1 num=$(date +%-S);rem=$(( num % 2 ));if [ $rem -eq 0 ] ; then echo 0 ; else echo 1 ; fi}==0}${image $HOME/.conky/cronograph/images/Blue.png -p 145, 32 -s 40x40}${endif}
${image $HOME/.conky/cronograph/images/Blank.png -p 145, 258 -s 40x40}${if_match ${execi 1 num=$(date +%-S);rem=$(( num % 2 ));if [ $rem -eq 0 ] ; then echo 0 ; else echo 1 ; fi}==0}${image $HOME/.conky/cronograph/images/Blue.png -p 145, 258 -s 40x40}${endif}
${image $HOME/.conky/cronograph/images/Blank.png -p 33, 145 -s 40x40}${if_match ${execi 1 num=$(date +%-S);rem=$(( num % 2 ));if [ $rem -eq 0 ] ; then echo 0 ; else echo 1 ; fi}==0}${image $HOME/.conky/cronograph/images/Blue.png -p 33, 145 -s 40x40}${endif}
${image $HOME/.conky/cronograph/images/Blank.png -p 257, 145 -s 40x40}${if_match ${execi 1 num=$(date +%-S);rem=$(( num % 2 ));if [ $rem -eq 0 ] ; then echo 0 ; else echo 1 ; fi}==0}${image $HOME/.conky/cronograph/images/Blue.png -p 257, 145 -s 40x40}${endif}
<img src="/upload/capture_deecran_2019_06_08_09_26.png" alt="capture_deecran_2019_06_08_09_26" title="capture_deecran_2019_06_08_09_26" />
le pack @ prendre ici
https://drive.google.com/open?id=0B1AG9vJlTZL-bVlQWUtncUE4LTg
@ extraire dans votre home (pas le .conky)
Le conkyrc
monn_MoonGiant (Je l'ai mis en françois)
<img src="/upload/capture_deecran_2019-07-20_09-40-31.png" alt="capture_deecran_2019-07-20_09-40-31" title="capture_deecran_2019-07-20_09-40-31" />
P.S Mettre les icones du dossier riseicons .jpg en .png avec gimp (@ cause du image .lua)
(Pour la météo il faut toujours le pack de Théo accuweather)
un de mes vieux ensemble de conky mis en version 1.10
pas de lecteurs jouant
<img src="/upload/capture_deecran_2019-09-29_11-16-03.png" alt="capture_deecran_2019-09-29_11-16-03" title="capture_deecran_2019-09-29_11-16-03" />
avec audacious
<img src="/upload/capture_deecran_2019-09-29_11-17-10.png" alt="capture_deecran_2019-09-29_11-17-10" title="capture_deecran_2019-09-29_11-17-10" />
avec radiotray-ng
<img src="/upload/capture_deecran_2019-09-29_11-15-05.png" alt="capture_deecran_2019-09-29_11-15-05" title="capture_deecran_2019-09-29_11-15-05" />
conkyrcs
time & weather
Code :
conky.config = {
background = true,
use_xft = true,
font = 'Liberation Sans:size=9',
xftalpha = 1,
update_interval = 1.0,
total_run_times = 0,
own_window = true,
own_window_transparent = true,
--own_window_color 000000
own_window_argb_visual = true,
--own_window_argb_value = 250,
own_window_type = 'normal',
own_window_hints = 'undecorated,below,skip_taskbar,skip_pager',
double_buffer = true,
minimum_width = 470, minimum_height = 170,
maximum_width = 470,
text_buffer_size = 2048,
draw_shades = false,
draw_outline = false,
draw_borders = false,
draw_graph_borders = false,
default_color = 'white',
default_outline_color = 'white',
alignment = 'top_right',
gap_x = 30,
gap_y = 10,
no_buffers = true,
uppercase = false,
cpu_avg_samples = 2,
override_utf8_locale = true,
imlib_cache_flush_interval = 60,
imlib_cache_size = 10000,
-- Taille des pointillés
stippled_borders = 5,
-- Couleurs
default_color = '#ffffff',--ffd579
default_shade_color = '#333333',
default_outline_color = 'black',
lua_load = '~/.conky/lua/image.lua',
};
conky.text = [[
${execi 180 bash $HOME/1_accuweather/1_accuweather -f}
${font Liberation Sans:size=26}${alignc 20}${time %a %d %b %H:%M}${font}
${goto 70}----------------------------------------------------------------------------
${goto 30}Aujourdh'ui ${goto 110}demain\
${goto 190}${execi 3600 echo `date --date="2 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="2 day" | awk '{print $2}'`}\
${goto 270}${execi 3600 echo `date --date="3 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="3 day" | awk '{print $2}'`}${voffset -14}
${goto 360}${execi 3600 echo `date --date="4 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="4 day" | awk '{print $2}'`}
${font conkyweather:size=30}${voffset -30}
${goto 40}${execi 600 sed -n '601p' $HOME/1_accuweather/daily_forecast}\
${goto 110}${execi 600 sed -n '602p' $HOME/1_accuweather/daily_forecast}\
${goto 190}${execi 600 sed -n '603p' $HOME/1_accuweather/daily_forecast}\
${goto 270}${execi 600 sed -n '604p' $HOME/1_accuweather/daily_forecast}\
${goto 360}${execi 600 sed -n '605p' $HOME/1_accuweather/daily_forecast}${font}
${goto 40}${texeci 600 sed -n '68p' $HOME/1_accuweather/daily_forecast}°/${texeci 600 sed -n '47p' $HOME/1_accuweather/daily_forecast}°\
${goto 110}${texeci 600 sed -n '108p' $HOME/1_accuweather/daily_forecast}°/${texeci 600 sed -n '87p' $HOME/1_accuweather/daily_forecast}°\
${goto 190}${texeci 600 sed -n '148p' $HOME/1_accuweather/daily_forecast}°/${texeci 600 sed -n '127p' $HOME/1_accuweather/daily_forecast}°\
${goto 270}${texeci 600 sed -n '188p' $HOME/1_accuweather/daily_forecast}°/${texeci 600 sed -n '167p' $HOME/1_accuweather/daily_forecast}°\
${goto 360}${texeci 600 sed -n '228p' $HOME/1_accuweather/daily_forecast}°/${texeci 600 sed -n '207p' $HOME/1_accuweather/daily_forecast}°\
${lua fDrawImage ~/.conky/diamond/pix/bg1.png 0 0 440 180 }
]];
cpu
Code :
conky.config = {
background = true,
use_xft = true,
font = 'Liberation Sans:size=9',
xftalpha = 1,
update_interval = 1.0,
total_run_times = 0,
own_window = true,
own_window_transparent = true,
--own_window_color 000000
own_window_argb_visual = true,
--own_window_argb_value = 250,
own_window_type = 'normal',
own_window_hints = 'undecorated,below,skip_taskbar,skip_pager',
double_buffer = true,
minimum_width = 470, minimum_height = 280,
maximum_width = 470,
text_buffer_size = 2048,
draw_shades = false,
draw_outline = false,
draw_borders = false,
draw_graph_borders = false,
default_color = 'white',
default_outline_color = 'white',
alignment = 'top_right',
gap_x = 00,
gap_y = 210,
no_buffers = true,
uppercase = false,
cpu_avg_samples = 2,
override_utf8_locale = true,
imlib_cache_flush_interval = 60,
imlib_cache_size = 10000,
-- Taille des pointillés
stippled_borders = 5,
-- Couleurs
default_color = '#ffffff',--ffd579
default_shade_color = '#333333',
default_outline_color = 'black',
lua_load = '~/.conky/lua/image.lua',
};
conky.text = [[
${voffset 30}${offset 50}Cpu1:${color DDF2FF} ${offset 3}${cpu cpu1}%${alignr 90}${voffset -5}${color #DBDBDB}${cpugraph cpu1 20,240 f1f1f1 DBDBDB}${color}
${voffset -3}${offset 50}CPU Step: ${alignr 80}${color DDF2FF}${freq_g} GHz${color}
${voffset 12}${offset 50}Cpu2:${color DDF2FF} ${offset 3}${cpu cpu2}%${alignr 90}${voffset -9}${color #DDF2FF}${cpugraph cpu2 20,240 f1f1f1 DBDBDB}${color}
${voffset -5}${alignc 10}---------------------------------------------------------------------------------
${voffset 15}${offset 50}RAM: ${alignr 80} $mem/${color #DDF2FF}$memmax${color}
${offset 50}${color #DDF2FF}${membar 5,340}${color}
${offset 50}Swap: ${alignr 80} $swap / ${color #DDF2FF}$swapmax${color}
${offset 50}${color #DDF2FF}${swapbar 5,340}${color}
${offset 50}ROOT:${color #DDF2FF} ${alignr 80} ${fs_free /} / ${fs_size /}
${offset 50}${fs_bar 5,340 /}${color}
${lua fDrawImage ~/.conky/diamond/pix/bg1.png 0 0 439 270}
]];
network
Code :
conky.config = {
background = true,
use_xft = true,
font = 'Liberation Sans:size=9',
xftalpha = 1,
update_interval = 1.0,
total_run_times = 0,
own_window = true,
own_window_transparent = true,
--own_window_color 000000
own_window_argb_visual = true,
--own_window_argb_value = 250,
own_window_type = 'normal',
own_window_hints = 'undecorated,below,skip_taskbar,skip_pager',
double_buffer = true,
minimum_width = 470, minimum_height = 170,
maximum_width = 470,
text_buffer_size = 2048,
draw_shades = false,
draw_outline = false,
draw_borders = false,
draw_graph_borders = false,
default_color = 'white',
default_outline_color = 'white',
alignment = 'top_right',
gap_x = 30,
gap_y = 470,
no_buffers = true,
uppercase = false,
cpu_avg_samples = 2,
override_utf8_locale = true,
imlib_cache_flush_interval = 60,
imlib_cache_size = 10000,
-- Taille des pointillés
stippled_borders = 5,
-- Couleurs
default_color = '#ffffff',--ffd579
default_shade_color = '#333333',
default_outline_color = 'black',
lua_load = '~/.conky/lua/image.lua',
};
conky.text = [[
${offset 25}${font Liberation Sans:size=11}SSID:${font} ${wireless_essid wlo1} ${goto 190}${font Liberation Sans:size=11}Sortant:${font} ${upspeed wlo1}
${offset 25}${font Liberation Sans:size=11}Bitrate:${font} ${wireless_bitrate wlo1} ${goto 190}${font Liberation Sans:size=11}Entrant:${font} ${downspeed wlo1}
${offset 25}${font Liberation Sans:size=11}Local:${font} ${addr wlo1} ${goto 190}${font Liberation Sans:size=11}Signal:${font} ${wireless_link_qual_perc wlo1}%
${lua fDrawImage ~/.conky/diamond/pix/bg1.png 0 0 440 102}
${if_match "${wireless_link_qual_perc wlo1}"<"1"} ${lua fDrawImage ~/.conky/diamond/pix/nonetwork.png 300 25 45 45}${else}
${if_match "${wireless_link_qual_perc wlo1}"<"20"}${lua fDrawImage ~/.conky/diamond/pix/networklow.png 300 25 45 45}${else}
${if_match "${wireless_link_qual_perc wlo1}"<"50"}${lua fDrawImage ~/.conky/diamond/pix/networkmid.png 300 25 45 45}${else}
${if_match "${wireless_link_qual_perc wlo1}"<"80"}${lua fDrawImage ~/.conky/diamond/pix/wlan80.png 300 25 45 45}${else}
${lua fDrawImage ~/.conky/diamond/pix/networkhigh.png 300 25 45 45}${endif}${endif}${endif}${endif}
]];
audacious
Code :
conky.config = {
background = true,
use_xft = true,
font = 'Liberation Sans:size=9',
xftalpha = 1,
update_interval = 1.0,
total_run_times = 0,
own_window = true,
own_window_transparent = true,
--own_window_color 000000
own_window_argb_visual = true,
--own_window_argb_value = 250,
own_window_type = 'normal',
own_window_hints = 'undecorated,below,skip_taskbar,skip_pager',
double_buffer = true,
minimum_width = 470, minimum_height = 280,
maximum_width = 470,
text_buffer_size = 2048,
draw_shades = false,
draw_outline = false,
draw_borders = false,
draw_graph_borders = false,
default_color = 'white',
default_outline_color = 'white',
alignment = 'top_right',
gap_x = 30,
gap_y = 580,
no_buffers = true,
uppercase = false,
cpu_avg_samples = 2,
override_utf8_locale = true,
imlib_cache_flush_interval = 60,
imlib_cache_size = 10000,
-- Taille des pointillés
stippled_borders = 5,
-- Couleurs
default_color = '#ffffff',--ffd579
default_shade_color = '#333333',
default_outline_color = 'black',
lua_load = '~/.conky/lua/image.lua',
};
conky.text = [[${if_running audacious}
${execi 3 ~/.conky/audacious/scripts/cover.sh}
${voffset -40}${font GE Inspira :size=12}
${goto 160}${execi 3 audtool current-song-tuple-data artist}${font}
${goto 160}${execi 3 audtool current-song-tuple-data title}
${goto 160}${execi 3 audtool current-song-tuple-data album}
${voffset 10}${goto 160}${execi 1 audtool current-song-output-length} ${goto 358}${execi 1 audtool current-song-length}\
${goto 184}${execbar 2, 168 expr 100 \* $(audtool --current-song-output-length-seconds) \/ $(audtool --current-song-length-seconds)}
${lua fDrawImage ~/.conky/diamond/pix/bg1.png 0 0 440 102}
${lua fDrawImage ~/.conky/audacious/audacious.png 44 14 68 70}
${else}
${if_running radiotray-ng}
${texeci 3 ~/.conky/radiotrayng/pochette.sh}${lua fDrawImage ~/.conky/diamond/pix/bg1.png 0 0 440 102}
${voffset -36}${alignc -80}${font GE Inspira:size=12}${execi 5 qdbus com.github.radiotray_ng /com/github/radiotray_ng com.github.radiotray_ng.get_player_state | jq -r '.station'}$font
${voffset 33}${alignc -20}${execi 4 qdbus com.github.radiotray_ng /com/github/radiotray_ng com.github.radiotray_ng.get_player_state | jq -r '.artist'}
${alignc -20}${execi 4 qdbus com.github.radiotray_ng /com/github/radiotray_ng com.github.radiotray_ng.get_player_state | jq -r '.title'}
${if_match "${execi 4 qdbus com.github.radiotray_ng /com/github/radiotray_ng com.github.radiotray_ng.get_player_state | jq -r '.station'}" == "RTL"} ${lua fDrawImage ~/.conky/radiotrayng/logos/rtl.png 222 32 50 50} ${else}
${if_match "${execi 4 qdbus com.github.radiotray_ng /com/github/radiotray_ng com.github.radiotray_ng.get_player_state | jq -r '.station'}" == "Hotmixradio 80"} ${lua fDrawImage ~/.conky/radiotrayng/logos/hotmix80.png 228 28 35 35} ${else}
${if_match "${execi 4 qdbus com.github.radiotray_ng /com/github/radiotray_ng com.github.radiotray_ng.get_player_state | jq -r '.station'}" == "Maxi 80"} ${lua fDrawImage ~/.conky/radiotrayng/logos/maxi80.png 230 29 35 35} ${else}
${if_match "${execi 4 qdbus com.github.radiotray_ng /com/github/radiotray_ng com.github.radiotray_ng.get_player_state | jq -r '.station'}" == "RTL2"} ${lua fDrawImage ~/.conky/radiotrayng/logos/rtl2.png 222 32 45 45} ${else}
${if_match "${execi 4 qdbus com.github.radiotray_ng /com/github/radiotray_ng com.github.radiotray_ng.get_player_state | jq -r '.station'}" == "MAGNUM LA RADIO"}${lua fDrawImage ~/.conky/radiotrayng/logos/magnumradio.png 184 26 120 40}${else}
${if_match "${execi 4 qdbus com.github.radiotray_ng /com/github/radiotray_ng com.github.radiotray_ng.get_player_state | jq -r '.station'}" == "radio swiss pop"}${lua fDrawImage ~/.conky/radiotrayng/logos/rspop.png 244 30 35 35} ${else}
${if_match "${execi 4 qdbus com.github.radiotray_ng /com/github/radiotray_ng com.github.radiotray_ng.get_player_state | jq -r '.station'}" == "rfm"} ${lua fDrawImage ~/.conky/radiotrayng/logos/rfm.png 224 35 45 45} ${endif}
${endif}${endif}${endif}${endif}${endif}${endif}
${if_match "${execi 4 qdbus com.github.radiotray_ng /com/github/radiotray_ng com.github.radiotray_ng.get_player_state | jq -r '.title'}" == ""}${lua fDrawImage ~/.conky/radiotrayng/logos/radio.png 30 10 78 78}
${else}
${lua fDrawImage ~/.conky/diamond/pochette.png 40 14 68 70}${endif}
${else}
${endif}
]];
le conkyrc
pochette.sh
<img src="/upload/capture_deecran_2021-07-03_09-15-10.png" alt="capture_deecran_2021-07-03_09-15-10" title="capture_deecran_2021-07-03_09-15-10" />
Il faut les deux packs de TeoBigusGeekus du forum Bunsenlabs et le pack meteo+lune 4
Accuweather
https://gitlab.com/teobigusgeekus/Accuweather_conky_script.git
Moongiant
https://gitlab.com/teobigusgeekus/Moongiant_conky_script.git
meteo+lune4
https://www.gnome-look.org/p/1155399/
le conkyrc
Code :
conky.config ={
total_run_times = 0,
double_buffer = true,
no_buffers = true,
text_buffer_size = 2048,
imlib_cache_size = 0,
update_interval = 1.0,
cpu_avg_samples = 1,
alignment = 'top_left',
minimum_width = 410, minimum_height = 981,
maximum_width = 430,
gap_x = 5,
gap_y = 0,
draw_shades = false,
draw_outline = false,
draw_borders = false,
border_inner_margin = 0,
border_outer_margin = 0,
background = true,
own_window = true,
own_window_type = 'normal',
own_window_hints = 'undecorated,below,skip_taskbar,skip_pager,',
own_window_transparent = true,
use_xft = true,
xftalpha = 1,
override_utf8_locale = true,
font = 'CorporateMonoExtraBold:size=10',
uppercase = false,
default_color = '#FFFFFF',
default_shade_color = '#000000',
default_outline_color = 'black',
color1 = 'b9b4b0', -- gris rosé
color2 = 'CA0000', -- rouge
color3 = '386fd5', -- bleu argent
color6 = 'b10ab3', -- mauve
color7 = 'f3ec1f', -- jaune
color8 = 'CCCCCC',
color9 = 'BBBBBB',
template1 = [[${font CorporateMonoExtraBold:size=\1}]],
template2 = [[${font Folks-Heavy:style=Bold:size=\1}]],
template3 = [[${font Liberation Sans:size=\1}]],
lua_load = '~/.conky/lua/image.lua',
};
conky.text = [[
${texeci 900 bash $HOME/Accuweather_conky_script/accuweather -f2015} ${texeci 3600 bash $HOME/Wunderground_conky_script/wunderground}${texeci 9500 bash $HOME/Moongiant_conky_script/moon_MoonGiant}
${voffset 15}${alignc}${color1}Sarreguemines
${alignc}${color1}${execi 600 sed -n '4p' $HOME/Accuweather_conky_script/curr_cond}
${voffset 10}${goto 120}${color3}Humidité: ${alignr 10}${color1}${texeci 600 sed -n '7p' $HOME/Accuweather_conky_script/curr_cond}
${goto 120}${color3}Pression: ${alignr 10}${color1}${texeci 600 sed -n '8p' $HOME/Accuweather_conky_script/curr_cond | awk '{print $2}'} mbar
${goto 120}${color3}Indice UV: ${alignr 10}${color1}${texeci 600 sed -n '9p' $HOME/Accuweather_conky_script/curr_cond}
${goto 120}${color3}Converture nuageuse: ${alignr 3}${color1}${texeci 600 sed -n '10p' $HOME/Accuweather_conky_script/curr_cond}
${goto 120}${color3}Point de rosée: ${alignr 10}${color1}${texeci 600 sed -n '12p' $HOME/Accuweather_conky_script/curr_cond}°C
${goto 120}${color3}Visibilité: ${alignr 10}${color1}${execi 600 sed -n '13p' $HOME/Accuweather_conky_script/curr_cond}s
${goto 120}${color3}Lever/Coucher: ${alignr 10}${color1}${execi 600 sed -n '14p' $HOME/Accuweather_conky_script/curr_cond} / ${execi 600 sed -n '15p' $HOME/Accuweather_conky_script/curr_cond}
${goto 120}${color3}Vent: ${alignr 10}${color1}${execi 600 sed -n '5p' $HOME/Accuweather_conky_script/curr_cond} ${texeci 600 sed -n '5p' $HOME/Accuweather_conky_script/curr_cond > $HOME/Accuweather_conky_script/vent}
${goto 120}${color3}Vitesse: ${alignr 10}${color1}${execi 600 sed -n '6p' $HOME/Accuweather_conky_script/curr_cond}
${voffset -90}${goto 30}${color1}${template1 14}T: ${execi 600 sed -n '2p' $HOME/Accuweather_conky_script/curr_cond}°C
${voffset 10} ${goto 30}${color1}${template1 14}R: ${execi 600 sed -n '3p' $HOME/Accuweather_conky_script/curr_cond}°C
${voffset 90}${template1 9}
${goto 100}Aujourd'hui ${goto 280}Demain
${goto 120}${color3}${texeci 600 sed -n '5p' $HOME/Accuweather_conky_script/daily_forecast}°${color}/${color2}${texeci 600 sed -n '4p' $HOME/Accuweather_conky_script/daily_forecast}°\
${goto 280}${color3}${execpi 600 sed -n '12p' $HOME/Accuweather_conky_script/daily_forecast}°${color}/${color2}${execpi 600 sed -n '11p' $HOME/Accuweather_conky_script/daily_forecast}°${color1}
${goto 80}${scroll 16 ${execpi 600 sed -n '6p' $HOME/Accuweather_conky_script/daily_forecast}}\
${goto 240}${scroll 16 ${execpi 600 sed -n '13p' $HOME/Accuweather_conky_script/daily_forecast}}
${voffset 60}
${goto 70}${execi 3600 echo `date --date="2 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="2 day" | awk '{print $2}'`}\
${goto 195}${execi 3600 echo `date --date="3 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="3 day" | awk '{print $2}'`}\
${goto 320}${execi 3600 echo `date --date="4 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="4 day" | awk '{print $2}'`}
${goto 70}${color3}${execpi 600 sed -n '19p' $HOME/Accuweather_conky_script/daily_forecast}°${color}/${color2}${execpi 600 sed -n '18p' $HOME/Accuweather_conky_script/daily_forecast}°\
${goto 195}${color3}${execpi 600 sed -n '26p' $HOME/Accuweather_conky_script/daily_forecast}°${color}/${color2}${execpi 600 sed -n '25p' $HOME/Accuweather_conky_script/daily_forecast}°\
${goto 320}${color3}${execpi 600 sed -n '33p' $HOME/Accuweather_conky_script/daily_forecast}°${color}/${color2}${execpi 600 sed -n '32p' $HOME/Accuweather_conky_script/daily_forecast}°${color1}
${goto 55}${scroll 12 ${execpi 600 sed -n '20p' $HOME/Accuweather_conky_script/daily_forecast}}\
${goto 180}${scroll 12 ${execpi 600 sed -n '27p' $HOME/Accuweather_conky_script/daily_forecast}}\
${goto 305}${scroll 12 ${execpi 600 sed -n '34p' $HOME/Accuweather_conky_script/daily_forecast}}
${voffset 75}${alignc}${color1}${template1 15}Calendrier Lunaire${font}
${voffset -5}${alignc}${color2}${template1 9}( Hémisphère Nord en GMT+1 Paris )${font}
${offset 40}
${alignc}${color3}Lever/Coucher:${color2}${template7 9}( Heure locale )$font
${alignc} ${template3 11}↑ ${template1 10}${execi 600 sed -n '18p' $HOME/Accuweather_conky_script/curr_cond} ${template3 11}↓ ${template1 10}${execi 600 sed -n '19p' $HOME/Accuweather_conky_script/curr_cond} = ${execi 600 sed -n '20p' $HOME/Accuweather_conky_script/curr_cond}
${alignc}${color3}Phase ${color1}${execpi 600 sed -n '1p' $HOME/Wunderground_conky_script/lune}
${template2 9}${voffset 20}
${goto 30}Visibilité: ${execpi 600 sed -n '23p' $HOME/Moongiant_conky_script/raw} ${goto 260}Angle: ${execpi 600 sed -n '25p' $HOME/Moongiant_conky_script/raw} °
${goto 30}Age: ${execpi 600 sed -n '24p' $HOME/Moongiant_conky_script/raw | awk '{print $1}'} Jour(s) ${goto 260}Dist.: ${execpi 600 sed -n '26p' $HOME/Moongiant_conky_script/raw}s
${voffset 80}${alignc}${color1}${template1 15}Éphéméride ${font}
${alignc}${color1}Saint(e) du jour
${alignc}${color2}${texeci 1000 wget -O - -q http://fetedujour.fr/ --user-agent="Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0" | grep h2 | head -1 | cut -d">" -f2 | cut -d"<" -f1 | cut -d":" -f2 }
#fond verticale
${lua fDrawImage $HOME/conky/meteo+lune4/icones/base/fond23x866.png 0 115 23 866}
#ligne rouge
${lua fDrawImage $HOME/conky/meteo+lune4/icones/base/rouge2.png 20 90 380 12}
${lua fDrawImage $HOME/conky/meteo+lune4/icones/base/rouge2.png 20 306 380 12}
${lua fDrawImage $HOME/conky/meteo+lune4/icones/base/rouge2.png 20 582 380 12}
${lua fDrawImage $HOME/conky/meteo+lune4/icones/base/rouge2.png 20 850 380 12}
#texte vertical
${lua fDrawImage $HOME/conky/meteo+lune4/icones/base/lateralf.png 4 125 15 851}
#icones
${lua fDrawImage $HOME/Accuweather_conky_script/forecast_2015/forecast_0.png 20 100 115 69}
${lua fDrawImage $HOME/Accuweather_conky_script/Wind1.png 40 220 70 70}
${lua fDrawImage $HOME/Accuweather_conky_script/forecast_2015/forecast_1.png 100 380 90 52}
${lua fDrawImage $HOME/Accuweather_conky_script/forecast_2015/forecast_2.png 260 380 90 52}
${lua fDrawImage $HOME/Accuweather_conky_script/forecast_2015/forecast_3.png 45 510 90 52}
${lua fDrawImage $HOME/Accuweather_conky_script/forecast_2015/forecast_4.png 170 510 90 52}
${lua fDrawImage $HOME/Accuweather_conky_script/forecast_2015/forecast_5.png 295 510 90 52}
${lua fDrawImage $HOME/Wunderground_conky_script/Forecast_Images/Moon_phase.png 160 730 90 90}
]];
<img src="/upload/capture_deecran_2021-09-26_10-29-07.png" alt="capture_deecran_2021-09-26_10-29-07" title="capture_deecran_2021-09-26_10-29-07" />
Avec la nouvelle syntaxe voici comment avoir un conky qui @ besoin de plusieurs scripts lua comme sur la version 1.09.
On va créer un fichier
" loader.lua" que l'on va appeler comme ceci dans le conky avant la partie conki.text=[[
loader.lua
- dofile .......datah.lua premier lua
-dofile .........draw_bg deuxième lua
-dofile ..........image.lua troisième lua
conky_widgets est la fonction du premier lua
les deux autres lua n'ont pas de fonction donc on ne mets rien.
un autre lanceur
Exemple
Un conky quatre lua .
<img src="/upload/capture_deecran_2023-04-24_09-34-43.png" alt="capture_deecran_2023-04-24_09-34-43" title="capture_deecran_2023-04-24_09-34-43" />
Conkyopen-meteo prise sur le site " prevision-meteo.ch" le site est en Français .
Vous pouvez vous faire un dossier icônes avec celles du site . Chez moi ce sont celles de Vclouds .
le conkyrc :
Code :
conky.config = {
background = true,
use_xft = true,
font = 'Liberation Sans:size=7',
xftalpha = 1,
update_interval = 1.0,
total_run_times = 0,
own_window = true,
own_window_transparent = false,
own_window_argb_visual = true,
own_window_argb_value = 00,
own_window_type = 'normal',
own_window_hints = 'undecorated,below,skip_taskbar,skip_pager',
double_buffer = true,
minimum_width = 270, minimum_height = 550,
maximum_width = 270,
text_buffer_size = 2048,
draw_shades = false,
draw_outline = false,
draw_borders = false,
draw_graph_borders = false,
default_color = 'white',
default_outline_color = 'white',
alignment = 'top_left',
gap_x = 52,
gap_y = 240,
no_buffers = true,
uppercase = false,
cpu_avg_samples = 2,
override_utf8_locale = true,
imlib_cache_flush_interval = 60,
imlib_cache_size = 10000,
-- Taille des pointillés
stippled_borders = 5,
-- Couleurs
default_color = '#ffffff',
default_shade_color = '#333333',
default_outline_color = 'black',
lua_load = '~/conky-openmeteo/Suisse/configs/loader.lua',
lua_draw_hook_pre = 'loader_lua',
color1 = 'F5B800',
color2 = '00f5ff',
color3 = '828200',
color4 = '323200',
color5 = 'fdb72e',
color7 = '6495ee',
color9 = 'red',
};
conky.text = [[${execi 1800 bash $HOME/conky-openmeteo/Suisse/suisse.sh}
##### premier cadre #####
### ${voffset -10}${font LED_mono :style=Medium:size=52}${color 434343}${goto 36}${time %H}${goto 136}${time %M}${font LED_mono :size=20:style=Medium}${color 292929}${goto 230}${time %S}$font
#### Date ####
${voffset 72}${alignc -100}${color yellow}${font URW Chancery L :italic:size=20}${time %A %d %B %Y}${voffset -14}
${font URW Chancery L :italic:size=14}${color ffe595}Sarreguemines$color${voffset -10}
${font URW Chancery L :italic:size=30}${goto 20}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.current_condition.tmp'} ° ${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.current_condition.tmp' > $HOME/conky-openmeteo/Suisse/barographe/temp}${voffset -60}
${font URW Chancery L :italic:size=10}${goto 220}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.current_condition.wnd_dir'}
${goto 210}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.current_condition.wnd_spd'} km/h
${goto 210}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.current_condition.wnd_gust'} km/h ${voffset -36}
${goto 30}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.current_condition.pressure' | cut -d'.' -f1} mb ${execi 3600 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.current_condition.pressure' | cut -d'.' -f1 > $HOME/conky-openmeteo/Suisse/barographe/pression}
${goto 30}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.current_condition.humidity'} % ${voffset -4}
${goto 30}${font Liberation Sans :size=10}↑${font URW Chancery L :italic:size=10} ${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.city_info.sunrise'}\
${goto 210}${font Liberation Sans :size=10}↓${font URW Chancery L :italic:size=10} ${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.city_info.sunset'}${voffset -20}
${alignc}${font URW Chancery L :italic:size=14}${color ffe595}${execi 3600 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.current_condition.condition'}
#### aujourdh'hui + demain ########
${voffset 26}
${goto 60}${color7}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_0.tmin'}°${color}/${color9}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_0.tmax'}°\
${goto 200}${color7}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_1.tmin'}°${color}/${color9}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_1.tmax'}°$color
${font URW Chancery L :italic:size=10}${voffset -26}
${goto 40}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_0.condition'}\
${goto 180}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_1.condition'}
${font URW Chancery L :italic:size=14}${voffset -30}
${goto 40}Aujourd'hui\
${goto 190}Demain
#### 3 jours suivant ########
${font URW Chancery L :italic:size=12}${voffset 20}
${goto 030}${color7}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_2.tmin'}°${color}/${color9}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_2.tmax'}°\
${goto 125}${color7}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_3.tmin'}°${color}/${color9}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_3.tmax'}°\
${goto 220}${color7}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_4.tmin'}°${color}/${color9}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_4.tmax'}°$color
${voffset -25}
${goto 020}${scroll 12 ${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_2.condition'}}\
${goto 115}${scroll 12 ${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_3.condition'}}\
${goto 210}${scroll 10 ${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_4.condition'}}
${voffset -25}
${goto 030}${execi 360 echo `date --date="2 day" | awk '{print $1}' | cut -c1-3`}.${execi 360 echo `date --date="2 day" | awk '{print $2}'`}\
${goto 125}${execi 360 echo `date --date="3 day" | awk '{print $1}' | cut -c1-3`}.${execi 360 echo `date --date="3 day" | awk '{print $2}'`}\
${goto 220}${execi 360 echo `date --date="4 day" | awk '{print $1}' | cut -c1-3`}.${execi 360 echo `date --date="4 day" | awk '{print $2}'`}
#### matin +midi+soir ########
${font URW Chancery L :italic:size=10}${voffset 22}
${goto 030}${color7}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_0.hourly_data."6H00".TMP2m' | awk '{printf("%d\n",$1)}'}°\
${goto 125}${color7}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_0.hourly_data."12H00".TMP2m' | awk '{printf("%d\n",$1)}'}°\
${goto 220}${color7}${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_0.hourly_data."18H00".TMP2m' | awk '{printf("%d\n",$1)}'}°$color
${voffset -25}
${goto 020}${scroll 12 ${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_0.hourly_data."7H00".CONDITION'}}\
${goto 115}${scroll 12 ${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_0.hourly_data."12H00".CONDITION'}}\
${goto 210}${scroll 12 ${execi 360 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.fcst_day_0.hourly_data."18H00".CONDITION'}}
${voffset -25}
${goto 025}Ce matin\
${goto 120}Ce midi\
${goto 215}Ce soir
${voffset -6}${alignc}${font URW Chancery L :italic:size=14} ${color ffe595}Dernière mise @ jour ${execpi 600 sed -n '1p' $HOME/conky-openmeteo/Suisse/actualisation | cut -c1-5}
#### Affichage utilisés dans le conky ####
#### premier cadre ####
${lua conky_draw_bg 20 0 98 270 450 0x000000 0.2}
${lua fDrawImage $HOME/conky-openmeteo/Suisse/fond/suite-bgv.png 000 090 273 460}
#${lua fDrawImage $HOME/conky-openmeteo/Suisse/fond/base5.png 000 040 270 200}
#${lua fDrawImage $HOME/conky-openmeteo/Suisse/fond/flip_bg.png 030 003 100 100}
#${lua fDrawImage $HOME/conky-openmeteo/Suisse/fond/flip_bg.png 130 003 100 100}
#${lua fDrawImage $HOME/conky-openmeteo/Suisse/fond/base5.png 000 260 270 076}
#${lua fDrawImage $HOME/conky-openmeteo/Suisse/fond/base5.png 000 360 270 076}
#${lua fDrawImage $HOME/conky-openmeteo/Suisse/fond/base5.png 000 460 270 076}
${lua fDrawImage $HOME/conky-openmeteo/Suisse/now.png 050 096 175 120}\
#${lua fDrawImage $HOME/conky-openmeteo/Suisse/Wind1.png 220 110 45 45}
${lua fDrawImage $HOME/conky-openmeteo/Suisse/d0.png 000 205 135 90}\
${lua fDrawImage $HOME/conky-openmeteo/Suisse/d1.png 134 205 135 90}\
${lua fDrawImage $HOME/conky-openmeteo/Suisse/d2.png 000 340 070 45}\
${lua fDrawImage $HOME/conky-openmeteo/Suisse/d3.png 095 340 070 45}\
${lua fDrawImage $HOME/conky-openmeteo/Suisse/d4.png 190 340 070 45}\
${lua fDrawImage $HOME/conky-openmeteo/Suisse/h7.png 000 440 070 45}\
${lua fDrawImage $HOME/conky-openmeteo/Suisse/h12.png 095 440 070 45}\
${lua fDrawImage $HOME/conky-openmeteo/Suisse/h18.png 190 440 070 45}\
${voffset -4000}
]];
le loader.lua "chemin @ modifier"
le suisse.sh
La suite du suisse.sh (le faux ruhm me dit que je dois le couper)
<img src="/upload/capture_deecran_2023-04-25_10-55-36.png" alt="capture_deecran_2023-04-25_10-55-36" title="capture_deecran_2023-04-25_10-55-36" />
Bonjour
Un baromêtre qui utilise les prévisions du conky précédent.
conkyrc
Code :
conky.config = {
background = true,
use_xft = true,
font = 'Bebas Neue Bold:size=12',
xftalpha = 1,
update_interval = 1.0,
total_run_times = 0,
own_window = true,
own_window_transparent = true,
--own_window_color 000000
own_window_argb_visual = true,
--own_window_argb_value = 250,
own_window_type = 'normal',
own_window_hints = 'undecorated,below,skip_taskbar,skip_pager',
double_buffer = true,
minimum_width = 290, minimum_height = 290,
maximum_width = 290,
text_buffer_size = 2048,
draw_shades = false,
draw_outline = false,
draw_borders = false,
draw_graph_borders = false,
default_color = 'white',
default_outline_color = 'white',
alignment = 'top_left',
gap_x = 40,
gap_y = 790,
no_buffers = true,
uppercase = false,
cpu_avg_samples = 2,
override_utf8_locale = true,
imlib_cache_flush_interval = 60,
imlib_cache_size = 10000,
-- Taille des pointillés
stippled_borders = 5,
-- Couleurs
default_color = '#ffffff',--ffd579
default_shade_color = '#333333',
default_outline_color = 'black',
lua_load = '~/.conky/barometr/loader.lua',
lua_draw_hook_pre = 'loader_lua',
};
conky.text = [[
${lua conky_draw_bg 126 20 18 260 260 0x000000 0.2}
${lua fDrawImage $HOME/conky-openmeteo/Suisse/fond/suite-bgv.png 15 10 270 270}
${execi 1800 bash $HOME/conky-openmeteo/Suisse/suisse.sh}
${execi 3600 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.current_condition.wnd_dir' > $HOME/.conky/barometr/dir}
${execi 3600 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.current_condition.wnd_spd' > $HOME/.conky/barometr/vit}
${execi 3600 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.current_condition.pressure' | awk '{printf("%d\n",$1)}' > $HOME/.conky/barometr/pre}
${execi 3600 cat $HOME/conky-openmeteo/rawdata/rawsuisse | jq --raw-output '.current_condition.humidity' > $HOME/.conky/barometr/hum}
${voffset -200}
]];
le loader.lua
barometr.lua
Code :
--[[ barometr_v.0.1.lua by olgmen 07.12.2010
script displays the weather forecast with http://weather.noaa.gov
Use scripts:
BARGRAPH WIDGET v2.0 by wlourf (12.07.2010)
circlewriting by mrpeachy (2010)
Скрипт выводит прогноз погоды с http://weather.noaa.gov
Использованы скрипты:
BARGRAPH WIDGET v2.0 by wlourf (12.07.2010)
circlewriting by mrpeachy (2010)
]]
require 'cairo'
-- [[ здесь вводятся все параметры ]] --
function conky_main_weather()
weather_settings = { -- ВЫВОД ГРАФИКИ
{ -- фон
sectors = 1,
gap_sectors = -1,
radius = 150,
thickness = 150,
bg_colour1 = {{0, 0x000000, 0.0}}, -- fond du grand cercle
},
{ -- обод
sectors = 1,
gap_sectors = -1,
radius = 0,
thickness = 3,
bg_colour1 = {{0, 0xFFFFFF, 0.7}},
bg_colour2 = {{0, 0x1B1A25, 1},{0.5, 0x7D7D78, 0.9},{1, 0x5D5D78, 0}}, -- grand cercle
},
{ -- фон шкалы барометра
radius = 111,
thickness = 7,
sectors = 1,
fill_sectors = true,
start_angle = -120,
end_angle = 120,
bg_colour1 = {{0, 0xffffff, 0.75}}, -- белый
},
{ -- деления шкалы барометра
radius = 110,
thickness = 5,
sectors = 80,
gap_sectors = 1,
fill_sectors = true,
start_angle = -120,
end_angle = 120,
bg_colour1 = {{0, 0x000000, 1}}, -- черный
},
{ -- деления шкалы термометра
radius = 110,
sectors = 9,
gap_sectors = 21,
start_angle = 125,
end_angle = 235,
bg_colour1 = {{0, 0xffffff, 0.5}}, -- белый
},
{ -- термометр
name = "temperature",
arg = conky_parse('${exec sed -n 1p $HOME/.conky/barometr/temp}'),
max = 80,
radius = 110,
thickness = 9,
sectors = 1,
start_angle = 130,
end_angle = 230,
inverse_arc = true,
cap = "r",
bg_colour1 = {{0.0, 0x999999, 0.0},{0.5, 0x999999, 1.0},{1.0, 0x999999, 0.0}},
fg_colour1 = {{0.0, 0xff0000, 0.0},{0.5, 0xff0000, 1.0},{1.0, 0xff0000, 0.0}},
fg_colour2 = {{0.0, 0x6495ee, 0.0},{0.5, 0x6495ee, 1.0},{1.0, 0x6495ee, 0.0}},
bd_colour1 = {{0.0, 0x00FF00, 1.0},{0.5, 0x00FF0, 1.0},{1.0, 0x00FF00, 1.0}},
},
}
text_settings = { -- ВЫВОД ТЕКСТОВ
{ -- температура
text = "TEMPERATURE " .. conky_parse('${exec sed -n 1p $HOME/conky-openmeteo/Suisse/barographe/temp}') .. "'C",
font_name = "MonogramsToolbox", -- навание шрифта
font_size = 8, -- размер шрифта
bold = true,
inside = true, -- размещение текста против часовой стрелки
start_angle = 233,
end_angle = 135,
radius = 95,
},
{ -- шкала термометра
text = " -40-30-20-10 0 10 20 30 40",
font_name = "URW Chancery L",
font_size = 14,
bold = true,
inside = true,
start_angle = 240,
end_angle = 131,
radius = 125,
},
{ -- погода
text = "Tempete Pluie Variable Beau Tres sec",
font_name = "URW Chancery L",
font_size = 18,
bold = true,
start_angle = 245,
end_angle = 472,
radius = 118,
},
{ -- давление в мм ртутного столба
text = "PRESSION " .. conky_parse('${exec sed -n 1p $HOME/.conky/barometr/pre}') .. "mb",
font_name = "MonogramsToolbox",
font_size = 8,
bold = true,
start_angle = 300,
end_angle = 417,
radius = 90,
},
{ -- направление и скорость ветра
text = "VIT. " .. conky_parse('${exec sed -n 1p $HOME/.conky/barometr/vit}') .. "km/h",
font_name = "MonogramsToolbox",
font_size = 8,
bold = true,
start_angle = 75,
end_angle = 120,
radius = 90,
},
{ -- влажность
text = "HUMIDITE " .. conky_parse('${exec sed -n 1p $HOME/.conky/barometr/hum}') .. "%",
font_name = "MonogramsToolbox",
font_size = 8,
bold = true,
inside = true,
start_angle = 228,
end_angle = 140,
radius = 78,
},
{ -- облачность
text = "DIR. " .. conky_parse('${exec sed -n 1p $HOME/.conky/barometr/dir}'),
font_name = "MonogramsToolbox",
font_size = 8,
bold = true,
start_angle = 240,
end_angle = 275,
radius = 90,
},
}
image_settings = { -- вывод центрального изображения
{
name = os.getenv ('HOME')..'/.conky/barometr/images/wind_rose.png', -- путь к картинке
},
}
needle_settings = { -- вывод стрелок
{
name = "vent", -- направление ветра
arg = conky_parse('${exec sed -n 1p $HOME/.conky/barometr/dir}'),
max = 360,
length_of_arrows = 1.75, -- длина стрелки
width_of_arrows = 6, -- ширина стрелки
},
{ -- давление
name = "pression",
arg = conky_parse('${exec sed -n 1p $HOME/.conky/barometr/pre}'),
max = 80,
start_angle = 242,
end_angle = 480,
length_of_arrows = 2.75,
width_of_arrows = 3,
},
}
----------- 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)
cr = cairo_create(cs)
if tonumber(conky_parse('${updates}')) > 1 then
for i in pairs(weather_settings) do
draw_weather_graph(weather_settings[i])
end
for i in pairs(text_settings) do
draw_circle_text(text_settings[i])
end
for i in pairs(image_settings) do
draw_image(image_settings[i])
end
for i in pairs(needle_settings) do
draw_needle_graph(needle_settings[i])
end
end
cairo_destroy(cr)
cairo_surface_destroy(cs)
end
-- -------------------------------------------------
-- функция вывода графики
function draw_weather_graph(t)
-- --------------------------------
-- функция перекодировки цвета
local function rgba_to_r_g_b_a(tcolour)
colour,alpha=tcolour[2],tcolour[3]
return ((colour / 0x10000) % 0x100) / 255.,
((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
-- ----------------------------------
local function calc_delta(tcol1,tcol2)
--calculate deltas P R G B A to table_colour 1
for x = 1, #tcol1 do
tcol1[x].dA = 0
tcol1[x].dP = 0
tcol1[x].dR = 0
tcol1[x].dG = 0
tcol1[x].dB = 0
if tcol2~=nil and #tcol1 == #tcol2 then
local r1,g1,b1,a1 = rgba_to_r_g_b_a(tcol1[x])
local r2,g2,b2,a2 = rgba_to_r_g_b_a(tcol2[x])
tcol1[x].dP = (tcol2[x][1]-tcol1[x][1])/t.sectors
tcol1[x].dR = (r2-r1)/t.sectors
tcol1[x].dG = (g2-g1)/t.sectors
tcol1[x].dB = (b2-b1)/t.sectors
tcol1[x].dA = (a2-a1)/t.sectors
end
end
return tcol1
end
-- --------------------------------------------
local function draw_scale (x, y, radius, max)
local i = 0
local winkel = math.rad(3)
cairo_set_source_rgba(cr,1,1,1,1)
for i = 0, max/2 - 1, 1 do
cairo_set_line_width(cr,1)
cairo_move_to(cr, x -radius- math.sin(winkel*i)*radius, y-radius - math.cos(winkel*i)*radius)
cairo_line_to(cr, x-radius - math.sin(winkel*i)*(radius*0.9), y-radius-math.cos(winkel*i)*(radius*0.9))
cairo_stroke(cr)
end
end
-- -------------------------------------------
--check values
local function setup(t)
-- сохраняем данные и настройки
cairo_save(cr)
-- установки по умолчанию
if t.name == nil then t.name= "" end
if t.arg == nil then t.arg = "" end
if t.max == nil then t.max = 100 end
if t.x == nil then t.x = conky_window.width/2 end
if t.y == nil then t.y = conky_window.height/2 end
if t.height == nil then t.height = conky_window.width end
if t.width == nil then t.width = conky_window.width end
if t.radius == nil then t.radius = (conky_window.width/2)*0.9 end
if t.start_angle == nil then t.start_angle=0 end
if t.end_angle == nil then t.end_angle = 360 end
if t.thickness == nil then t.thickness = 10 end
if t.sectors == nil then t.sectors = 10 end
if t.gap_sectors == nil then t.gap_sectors = 1 end
if t.fill_sector == nil then t.fill_sector = false end
if t.sectors == 1 then t.fill_sector = false end
if t.border_size == nil then t.border_size = 0 end
if t.cap == nil then t.cap = "p" end
-- цвет фона
if t.bg_colour1 == nil then
t.bg_colour1 = {{0, 0x00ffff, 0.1},{0.5, 0x00FFFF, 0.5},{1, 0x00FFFF, 0.1}}
end
-- цвет параметра
if t.fg_colour1 == nil then
t.fg_colour1 = {{0, 0x00FF00, 0.1},{0.5, 0x00FF00, 1},{1, 0x00FF00, 0.1}}
end
-- цвет окантовки
if t.bd_colour1 == nil then
t.bd_colour1 = {{0, 0xFFFF00, 0.5},{0.5, 0xFFFF00, 1},{1, 0xFFFF00, 0.5}}
end
-- проверяем соотношение ширины кольца и радиуса
if t.thickness > t.radius then t.thickness = t.radius*0.1 end
t.int_radius = t.radius - t.thickness
-- проверяем данные углов
if t.start_angle >= t.end_angle then
local tmp_angle = t.end_angle
t.end_angle = t.start_angle
t.start_angle = tmp_angle
-- print ("inversed angles")
if t.end_angle-t.start_angle > 360 and t.start_angle > 0 then
t.end_angle = 360 + t.start_angle
print ("reduce angles")
end
if t.end_angle + t.start_angle > 360 and t.start_angle <= 0 then
t.end_angle = 360 + t.start_angle
print ("reduce angles")
end
if t.int_radius < 0 then t.int_radius = 0 end
if t.int_radius > t.radius then
local tmp_radius = t.radius
t.radius = t.int_radius
t.int_radius = tmp_radius
print ("inversed radius")
end
if t.int_radius == t.radius then
t.int_radius = 0
print ("int radius set to 0")
end
end
-- проверка таблиц цвета
for i = 1, #t.bg_colour1 do
if #t.bg_colour1[i] ~= 3 then t.bg_colour1[i] = {1, 0xFFFFFF, 0.5} end
end
for i = 1, #t.fg_colour1 do
if #t.fg_colour1[i] ~= 3 then t.fg_colour1[i] = {1, 0xFF0000, 1} end
end
for i = 1, #t.bd_colour1 do
if #t.bd_colour1[i] ~= 3 then t.bd_colour1[i] = {1, 0xFFFF00, 1} end
end
if t.bg_colour2 ~= nil then
for i = 1, #t.bg_colour2 do
if #t.bg_colour2[i] ~= 3 then t.bg_colour2[i] = {1, 0xFFFFFF, 0.5} end
end
end
if t.fg_colour2 ~= nil then
for i = 1, #t.fg_colour2 do
if #t.fg_colour2[i] ~= 3 then t.fg_colour2[i] = {1, 0xFF0000, 1} end
end
end
if t.bd_colour2 ~= nil then
for i = 1, #t.bd_colour2 do
if #t.bd_colour2[i] ~= 3 then t.bd_colour2[i] = {1, 0xFFFF00, 1} end
end
end
t.fg_colour1 = calc_delta(t.fg_colour1,t.fg_colour2)
t.bg_colour1 = calc_delta(t.bg_colour1,t.bg_colour2)
t.bd_colour1 = calc_delta(t.bd_colour1,t.bd_colour2)
end
setup(t)
--initialize cairo context
cairo_save(cr)
cairo_translate(cr, t.x, t.y)
cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND)
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND)
--get value
local value = 0
-- --------------------------------------------- обработка вывода температуры
if t.name == "temperature" then t.name = "" end
-- -------------------------------------------------------------------------
if t.name ~= "" then
value = tonumber(conky_parse(string.format('${%s %s}', t.name, t.arg)))
else
value = tonumber(t.arg)
end
if value==nil then value =0 end
--initialize sectors
--angle of a sector :
angleA = ((t.end_angle-t.start_angle)/t.sectors)*math.pi/180
--value of a sector :
valueA = t.max/t.sectors
--first angle of a sector :
lastAngle = t.start_angle*math.pi/180
local function draw_sector(type_arc,angle0,angle,valpc, idx)
--this function draws a portion of arc
--type of arc, angle0 = strating angle, angle= angle of sector,
--valpc = percentage inside the sector, idx = sctor number #
if type_arc=="bg" then --background
if valpc==1 then return end
tcolor=t.bg_colour1
elseif type_arc=="fg" then --foreground
if valpc==0 then return end
tcolor=t.fg_colour1
elseif type_arc=="bd" then --border
tcolor=t.bd_colour1
end
--angles equivalents to gap_sector
local ext_delta=math.atan(t.gap_sectors/(2*t.radius))
local int_delta=math.atan(t.gap_sectors/(2*t.int_radius))
--angles of arcs
local ext_angle=(angle-ext_delta*2)*valpc
local int_angle=(angle-int_delta*2)*valpc
--define colours to use for this sector
if #tcolor==1 then
--plain color
local vR,vG,vB,vA = rgba_to_r_g_b_a(tcolor[1])
cairo_set_source_rgba(cr,vR+tcolor[1].dR*idx,
vG+tcolor[1].dG*idx,
vB+tcolor[1].dB*idx,
vA+tcolor[1].dA*idx )
else
--radient color
local pat=cairo_pattern_create_radial(0,0,t.int_radius,0,0,t.radius)
for i=1, #tcolor do
local vP,vR,vG,vB,vA = tcolor[i][1], rgba_to_r_g_b_a(tcolor[i])
cairo_pattern_add_color_stop_rgba (pat,
vP+tcolor[i].dP*idx,
vR+tcolor[i].dR*idx,
vG+tcolor[i].dG*idx,
vB+tcolor[i].dB*idx,
vA+tcolor[i].dA*idx )
end
cairo_set_source (cr, pat)
cairo_pattern_destroy(pat)
end
--start drawing
cairo_save(cr)
--x axis is parrallel to start of sector
cairo_rotate(cr,angle0-math.pi/2)
local ri,re = t.int_radius ,t.radius
--point A
local angle_a
if t.cap == "p" then
angle_a = int_delta
if t.inverse_arc and type_arc ~="bg" then
angle_a = angle-int_angle-int_delta
end
if not(t.inverse_arc) and type_arc =="bg" then
angle_a = int_delta+int_angle
end
else --t.cap=="r"
angle_a = ext_delta
if t.inverse_arc and type_arc~="bg" then
angle_a = angle-ext_angle-ext_delta
end
if not(t.inverse_arc) and type_arc=="bg" then
angle_a = ext_delta+ext_angle
end
end
local ax,ay = ri*math.cos(angle_a),ri*math.sin(angle_a)
--point B
local angle_b = ext_delta
if t.cap == "p" then
if t.inverse_arc and type_arc ~="bg" then
angle_b = angle-ext_angle-ext_delta
end
if not(t.inverse_arc) and type_arc=="bg" then
angle_b = ext_delta+ext_angle
end
else
if t.inverse_arc and type_arc ~="bg" then
angle_b = angle-ext_angle-ext_delta
end
if not(t.inverse_arc) and type_arc=="bg" then
angle_b = ext_delta+ext_angle
end
end
local bx,by = re*math.cos(angle_b),re*math.sin(angle_b)
-- EXTERNAL ARC B --> C
if t.inverse_arc then
if type_arc=="bg" then
b0,b1= ext_delta, angle-ext_delta-ext_angle
else
b0,b1= angle-ext_angle-ext_delta, angle-ext_delta
end
else
if type_arc=="bg" then
b0,b1= ext_delta+ext_angle, angle-ext_delta
else
b0,b1= ext_delta, ext_angle+ext_delta
end
end
---POINT D
local angle_c
if t.cap == "p" then
angle_d = angle-int_delta
if t.inverse_arc and type_arc=="bg" then
angle_d = angle-int_delta-int_angle
end
if not(t.inverse_arc) and type_arc~="bg" then
angle_d=int_delta+int_angle
end
else
angle_d = angle-ext_delta
if t.inverse_arc and type_arc=="bg" then
angle_d =angle-ext_delta-ext_angle
end
if not(t.inverse_arc) and type_arc~="bg" then
angle_d = ext_angle+ext_delta
end
end
local dx,dy = ri*math.cos(angle_d),ri*math.sin(angle_d)
-- INTERNAL ARC D --> A
if t.cap=="p" then
if t.inverse_arc then
if type_arc=="bg" then
d0,d1= angle-int_delta-int_angle,int_delta
else
d0,d1= angle-int_delta, angle- int_angle-int_delta
end
else
if type_arc=="bg" then
d0,d1= angle-int_delta, int_delta+int_angle
else
d0,d1= int_delta+int_angle, int_delta
end
end
else
if t.inverse_arc then
if type_arc=="bg" then
d0,d1= angle-ext_delta-ext_angle,ext_delta
else
d0,d1= angle-ext_delta, angle- ext_angle-ext_delta
end
else
if type_arc=="bg" then
d0,d1= angle-ext_delta,ext_delta+ext_angle
else
d0,d1= ext_angle+ext_delta, ext_delta
end
end
end
--draw sector
cairo_move_to(cr,ax,ay)
cairo_line_to(cr,bx,by)
cairo_arc(cr,0,0,re,b0,b1)
cairo_line_to(cr,dx,dy)
cairo_arc_negative(cr,0,0,ri,d0,d1)
cairo_close_path (cr);
--stroke or fill sector
if type_arc=="bd" then
cairo_set_line_width(cr,t.border_size)
cairo_stroke(cr)
else
cairo_fill(cr)
end
cairo_restore(cr)
end
--draw sectors
local n0,n1,n2 = 1,t.sectors,1
if t.inverse_arc then n0,n1,n2 = t.sectors,1,-1 end
local index = 0
for i = n0,n1,n2 do
index = index +1
local valueZ=1
local cstA, cstB = (i-1),i
if t.inverse_arc then cstA,cstB = (t.sectors-i), (t.sectors-i+1) end
if value>valueA *cstA and value<valueA*cstB then
if not t.fill_sector then
valueZ = (value-valueA*cstA)/valueA
end
else
if value<valueA*cstB then valueZ=0 end
end
local start_angle= lastAngle+(i-1)*angleA
if t.foreground ~= false then
draw_sector("fg",start_angle,angleA,valueZ, index)
end
if t.background ~= false then
draw_sector("bg",start_angle,angleA,valueZ, i)
end
if t.border_size>0 then draw_sector("bd",start_angle,angleA,1, i) end
end
cairo_restore(cr)
end
--[[END OF RING-SECTORS WIDGET]]
-- -----------------------------------------------------------------------
-- [[ TEXT ]] --
-- функция добавления незначащих нулей
function addzero100(num)
if tonumber(num) == nil then return end --tonumber(num) == 0 end
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 rgb_to_r_g_b2(tcolour)
colour,alpha=tcolour[2],tcolour[3]
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
-- ----------------------------------
function calc_delta(tcol1,tcol2)
--calculate deltas P R G B A to table_colour 1
for x = 1, #tcol1 do
tcol1[x].dA = 0
tcol1[x].dP = 0
tcol1[x].dR = 0
tcol1[x].dG = 0
tcol1[x].dB = 0
if tcol2~=nil and #tcol1 == #tcol2 then
local r1,g1,b1,a1 = rgba_to_r_g_b_a(tcol1[x])
local r2,g2,b2,a2 = rgba_to_r_g_b_a(tcol2[x])
tcol1[x].dP = (tcol2[x][1]-tcol1[x][1])/t.sectors
tcol1[x].dR = (r2-r1)/t.sectors
tcol1[x].dG = (g2-g1)/t.sectors
tcol1[x].dB = (b2-b1)/t.sectors
tcol1[x].dA = (a2-a1)/t.sectors
end
end
return tcol1
end
-- --------------------------------------------
function draw_circle_text(t)
-- проверка вводимых параметров и установка параметров по умолчанию
if t.text == nil then t.text = "Conky c'est pour pour le moral !" end
if t.x == nil then t.x = conky_window.width/2 end
if t.y == nil then t.y = conky_window.height/2 end
if t.radius == nil then t.radius = (conky_window.width/2)*0.9 end
if t.font_name == nil then t.font_name = "Free Sans" end
if t.font_size == nil then t.font_size = 14 end
if t.start_angle == nil then t.start_angle = 120 end
if t.end_angle == nil then t.end_angle = 240 end
if t.italic == nil then t.italic = false end
if t.oblique == nil then t.oblique = false end
if t.bold == nil then t.bold = false end
if t.inside == nil then inside = nil end
if t.align == nil then t.align = 0 end
local slant = CAIRO_FONT_SLANT_NORMAL
local weight =CAIRO_FONT_WEIGHT_NORMAL
if t.italic then slant = CAIRO_FONT_SLANT_ITALIC end
if t.oblique then slant = CAIRO_FONT_SLANT_OBLIQUE end
if t.bold then weight = CAIRO_FONT_WEIGHT_BOLD end
cairo_select_font_face(cr, t.font_name, slant,weight)
local inum = string.len(t.text)
if t.inside ~= nil then
deg = (t.start_angle - t.end_angle)/(inum - 1)
else
range = t.end_angle
deg = (t.end_angle - t.start_angle)/(inum-1)
end
degrads = 1*(math.pi/180)
local textcut = string.gsub(t.text, ".", "%1@@@")
texttable = string.split(textcut, "@@@")
for i = 1, inum do
ival = i
if t.inside ~= nil then
interval = (degrads*(t.start_angle - (deg*(i - 1)))) + t.align
interval2 = degrads*(t.start_angle - (deg*(i - 1)))
else
interval = (degrads*(t.start_angle + (deg*(i - 1)))) + t.align
interval2 = degrads*(t.start_angle + (deg*(i - 1)))
end
txs = 0 + t.radius*(math.sin(interval))
tys = 0 - t.radius*(math.cos(interval))
cairo_set_font_size (cr, t.font_size)
cairo_set_source_rgba(cr, 1, 1, 1, 1)
cairo_move_to (cr, txs + t.x, tys + t.y)
if t.inside ~= nil then
cairo_rotate (cr, interval2 + (180*math.pi/180))
else
cairo_rotate (cr, interval2)
end
cairo_show_text (cr, (texttable[i]))
if t.inside ~= nil then
cairo_rotate (cr, -interval2 - (180*math.pi/180))
else
cairo_rotate (cr, -interval2)
end
end
end
-- ---------------------------------
function draw_image(t)
-- --------------------------------
-- установки по умолчанию
if t.name == nil then t.name= "" end
if t.x == nil then t.x = conky_window.width/2 end
if t.y == nil then t.y = conky_window.height/2 end
if t.height == nil then t.height = conky_window.width end
if t.width == nil then t.width = conky_window.width end
-- создаём имидж изображения
image_bg = cairo_image_surface_create_from_png (t.name)
-- забираем данные о ширине и высоте изображения из образа
w1 = cairo_image_surface_get_width (image_bg)
h1 = cairo_image_surface_get_height (image_bg)
-- выводим изображение
cairo_set_source_surface (cr, image_bg, t.x - w1/2, t.y - h1/2)
cairo_paint (cr)
cairo_surface_destroy (image_bg)
end
-- --------------------------------------------------
function draw_needle_graph (t)
-- установки по умолчанию
if t.name == nil then t.name= "time" end
if t.arg == nil then t.arg = "%S" end
if t.max == nil then t.max = 60 end
if t.x == nil then t.x = conky_window.width/2 end
if t.y == nil then t.y = conky_window.height/2 end
if t.radius == nil then t.radius = 100 end
if t.start_angle == nil then t.start_angle = 0 end
if t.end_angle == nil then t.end_angle = 360 end
if t.width_of_arrows == nil then t.width_of_arrows = 2 end
if t.length_of_arrows == nil then t.length_of_arrows = 2.2 end
if t.name == "vent" then
if t.arg == "S" then t.arg = 180.0 end
if t.arg == "NNE" then t.arg = 202.5 end
if t.arg == "SO" then t.arg = 225.0 end
if t.arg == "ENE" then t.arg = 247.5 end
if t.arg == "O" then t.arg = 270.0 end
if t.arg == "ESE" then t.arg = 292.5 end
if t.arg == "NO" then t.arg = 315.0 end
if t.arg == "SSE" then t.arg = 337.5 end
if t.arg == "N" then t.arg = 360.0 end
if t.arg == "SSO" then t.arg = 22.5 end
if t.arg == "NE" then t.arg = 45.0 end
if t.arg == "OSO" then t.arg = 67.5 end
if t.arg == "E" then t.arg = 90.0 end
if t.arg == "ONO" then t.arg = 112.5 end
if t.arg == "SE" then t.arg = 135.0 end
if t.arg == "NNO" then t.arg = 157.5 end
end
value = tonumber(conky_parse(t.arg))
if value == nil then value = 0 end
-- начальный угол
local sa = t.start_angle * (math.pi / 180)
-- конечный угол
local ea = t.end_angle * (math.pi / 180)
-- расчет угла движения стрелки
gamma = math.pi/2-math.atan(t.width_of_arrows/(t.radius*t.length_of_arrows))
arc = ((ea - sa)/t.max)* value + sa
arc0=arc-gamma
arc1=arc+gamma
xx = t.x + t.radius*math.sin(arc)*t.length_of_arrows
yy = t.y - t.radius*math.cos(arc)*t.length_of_arrows
x0 = t.x + t.width_of_arrows*math.sin(arc0)
y0 = t.y - t.width_of_arrows*math.cos(arc0)
x1 = t.x + t.width_of_arrows*math.sin(arc1)
y1 = t.y - t.width_of_arrows*math.cos(arc1)
cairo_set_line_width(cr,1)
cairo_set_source_rgba(cr, 0, 0, 0, 0.5)
-- рисуем стрелку
-- dessiner une flèche
cairo_move_to (cr, x0, y0)
cairo_curve_to (cr, x0, y0, xx, yy, x1, y1)
cairo_arc(cr, t.x, t.y, t.width_of_arrows, arc1, arc0)
pat = cairo_pattern_create_radial (t.x, t.y, t.radius/10, t.x, t.y, t.radius*t.length_of_arrows)
if t.name == "vent" then
-- для ветра устанавливаем цвет синий переходящий в красный (не очень заметно)
--régler la couleur du vent de bleu à rouge (pas très visible)
cairo_pattern_add_color_stop_rgba (pat, 0.6, 0.4, 0.6, 0.9, 0.8) --bleu
cairo_pattern_add_color_stop_rgba (pat, 0.6, 1, 1, 0.8, 1) --rouge
else
-- для давления красный
-- pour la pression rouge
cairo_pattern_add_color_stop_rgba (pat, 0, 0.8, 0, 0, 0.8)
cairo_pattern_add_color_stop_rgba (pat, 1, 1, 0, 0, 1) -- rouge
end
cairo_set_source (cr, pat)
cairo_fill (cr)
cairo_pattern_destroy (pat)
end
--[[ Немного поясню, из чего состоит строка
cairo_pattern_add_color_stop_rgba (pat, 1, 1, 0, 0, 0.5)
цифры означают: 1- слой, 1-красный, 0-зеленый, 0-синий, 0.5-насыщенность
слой имеет значения от 0 до 1]]--
--[[[ Je vais expliquer un peu en quoi consiste la chaîne de caractères
cairo_pattern_add_color_stop_rgba (pat, 1, 1, 0, 0, 0.5)
les nombres signifient : 1-couche, 1-rouge, 0-vert, 0-bleu, 0,5-saturation
la couche a des valeurs de 0 à 1]]--.
<img src="/upload/capture_deecran_2023-04-25_11-06-05.png" alt="capture_deecran_2023-04-25_11-06-05" title="capture_deecran_2023-04-25_11-06-05" />
conkyrc
Code :
--[[ pkill -xf "conky -c ~/Conky/The_Clock.conky" &
Chronograph LUA - mrpeachy (originally 4 clocks - tweaked by Sector11)
LUA-Syntax 1.10, 04-2023 @unklar
https://thepeachyblog.blogspot.com/p/index-or-home-page.html
]]
conky.config = {
own_window = true,
--own_window_colour ff0000
own_window_class = 'Conky',
own_window_transparent = true,
own_window_argb_visual = true,
own_window_type = 'normal',
own_window_hints = 'undecorated,below,skip_taskbar,skip_pager',--
minimum_width = 280, minimum_height = 280,
maximum_width = 280,
alignment = 'top_right',-- tl, tm, tr, bl, bm, br, ml, mr
gap_x = 40,
gap_y = 790,
background = false,
draw_borders = false,
stippled_borders = 1,
border_width = 1,
draw_graph_borders = false,
draw_shades = false,
draw_outline = false,
use_spacer = 'right',
default_color = 'ffffff',
default_shade_color = '000000',
default_outline_color = 'ffffff',
color0 = 'FFFF00',
color1 = 'white',
color2 = 'yellow',
color3 = 'red',
use_xft = true,
font = 'Ubuntu:size=9',
xftalpha = 1,
uppercase = false,
override_utf8_locale = true,
update_interval = 1,
total_run_times = 0,
double_buffer = true,
no_buffers = true,
cpu_avg_samples = 2,
net_avg_samples = 2,
imlib_cache_size = 0,
short_units = true,
pad_percents = 2,
text_buffer_size = 2048,
imlib_cache_size = 00,
lua_load = '~/.conky/cronographe/loader.lua',
lua_draw_hook_pre = 'loader_lua',
};
conky.text = [[
${lua fDrawImage $HOME/.conky/cronographe/suite-bgv.png 15 15 270 270}
${lua fDrawImage $HOME/.conky/cronographe/c2.png -6 -5 314 314}
]];
loader
crono.lua
Code :
--chronograph mrpeachy 12/13/12 - i blame sector11 for starting the whole chronograph thing!
require 'cairo'
extents=cairo_text_extents_t:create()
tolua.takeownership(extents)
function conky_main()
if conky_window == nil then return end
local updates=tonumber(conky_parse("${updates}"))
if updates<=3 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)
--#########################################################################################################
--defaults
default_font_name="White Rabbit"
default_font_size=16
default_font_face="n"
default_hex_color=0xffffff
default_alpha=1
default_red=1
default_green=1
default_blue=1
default_horizontal_justify="l" --"l"=left, "r"=right, "c"=center
default_vertical_justify="n" --"n"=normal, "nb"=normal-ybearing, "m"=middle, "mb"=middle-ybearing, "t"=top
default_rotation="0"
--font({f="name",fs=size,ff="face"}) face="n" or "b" or "i" or "bi"
--hexcolor({c=hexcolor,a=alpha})
--rgbcolor({r=,g=,b=,a=})
--text({x=x,y=y,t="text",hj=horizontal_justify,vj=vertical_justify,r=rotation})
--set center coordinates
centx,centy=150,150
--########################################################################################
--background circle
hexcolor({c=0x000000,a=0.3})
cairo_arc(cr,centx,centy,120,0,2*math.pi)
cairo_fill(cr)
--background circle
hexcolor({c=0x000000,a=0.0})
cairo_arc(cr,centx,centy,108,0,2*math.pi)
cairo_fill(cr)
--setup font and color
font({})
hexcolor({c=0xffffff})
--draw numbers and dots around main circle
for i=1,12 do
if i==12 or i==4 or i==8 then
x,y=pt(centx,centy,84,((360/12)*i))
text({y=y,x=x,t=i,hj="c",vj="m"})
end
if i==2 or i==6 or i==10 then
hexcolor({c=0xffffff})
x,y=pt(centx,centy,98,((360/12)*i))
cairo_arc(cr,x,y,6,0,2*math.pi)
cairo_fill(cr)
else
hexcolor({c=0xffffff})
x,y=pt(centx,centy,98,((360/12)*i))
cairo_arc(cr,x,y,4,0,2*math.pi)
cairo_fill(cr)
end
end--for
--draw inbetween marks
cairo_set_line_width(cr,1)
for i=1,60 do
if string.find(i/5,"%.")~=nil then
x,y=pt(centx,centy,108,((360/60)*i))
cairo_move_to(cr,x,y)
x,y=pt(centx,centy,98,((360/60)*i))
cairo_line_to(cr,x,y)
cairo_stroke(cr)
end
end--for
--outer circle
cairo_arc(cr,centx,centy,108,0,2*math.pi)
cairo_stroke(cr)
--########################################################################################
--hours of day at 2 position
dcx,dcy=pt(centx,centy,98,60)
font({fs=8})
--numbers
for i=0,24,3 do
x,y=pt(dcx,dcy,68,180+((120/24)*i))
text({y=y,x=x,t=string.format("%02d",i),hj="c",vj="m"})
end--for
--marks
for i=0,24 do
if string.find(i/3,"%.")~=nil and i~=0 then
x,y=pt(dcx,dcy,60,180+((120/24)*i))
cairo_move_to(cr,x,y)
x,y=pt(dcx,dcy,56,180+((120/24)*i))
cairo_line_to(cr,x,y)
cairo_stroke(cr)
else
x,y=pt(dcx,dcy,58,180+((120/24)*i))
cairo_arc(cr,x,y,1.5,0,2*math.pi)
cairo_fill(cr)
end
end
--day name
font({fs=14})
dtx,dty=pt(dcx,dcy,30,180+60)
text({x=dtx,y=dty,t=string.upper(os.date("%a")),hj="c",vj="m"})
--indicator
cairo_set_line_width(cr,2)
hexcolor({c=0xffffff})
hour=tonumber(os.date("%H"))
dpx,dpy=pt(dcx,dcy,54,180+(120*(hour/24)))
cairo_move_to(cr,dcx,dcy)
cairo_line_to(cr,dpx,dpy)
cairo_stroke(cr)
--########################################################################################
--days of month at 6 position
font({fs=8})
hexcolor({c=0xffffff})
cairo_set_line_width(cr,1)
mcx,mcy=pt(centx,centy,98,180)
--date calcs
local year=os.date("%G")
local today=tonumber(os.date("%d"))
local t1 = os.time({year=year,month=03,day=01,hour=00,min=0,sec=0});
local t2 = os.time({year=year,month=02,day=01,hour=00,min=0,sec=0});
local feb=(os.difftime(t1,t2))/(24*60*60)
local monthdays={31,feb,31,30,31,30,31,31,30,31,30,31}
local month=os.date("%m")
local mdays=monthdays[tonumber(month)]
--marks
for i=1,mdays do
if string.find((i-1)/3,"%.")~=nil then
x,y=pt(mcx,mcy,60,300+((120/mdays)*i))
cairo_move_to(cr,x,y)
x,y=pt(mcx,mcy,56,300+((120/mdays)*i))
cairo_line_to(cr,x,y)
cairo_stroke(cr)
else
x,y=pt(mcx,mcy,60,300+((120/mdays)*i))
cairo_move_to(cr,x,y)
x,y=pt(mcx,mcy,54,300+((120/mdays)*i))
cairo_line_to(cr,x,y)
cairo_stroke(cr)
end
end--for
--numbers
for i=1,mdays,3 do
x,y=pt(mcx,mcy,68,300+((120/mdays)*i))
text({y=y,x=x,t=string.format("%02d",i),hj="c",vj="m"})
end--for
--month name
font({fs=16})
text({x=mcx,y=mcy-30,t=string.upper(os.date("%b")),hj="c",vj="m"})
--indicator
cairo_set_line_width(cr,2)
hexcolor({c=0xffffff})
day=tonumber(os.date("%e"))
mpx,mpy=pt(mcx,mcy,52,300+(120*(day/mdays)))
cairo_move_to(cr,mcx,mcy)
cairo_line_to(cr,mpx,mpy)
cairo_stroke(cr)
--########################################################################################
--months of year at 10 position
font({fs=8})
hexcolor({c=0xffffff})
cairo_set_line_width(cr,1)
ycx,ycy=pt(centx,centy,98,5*60)
--date calculations
td=0
for i=1,12 do
td=td+monthdays[i]
end
angle={}
ang=0
for i=1,12 do
ang=((monthdays[i]/td)*120)+ang
angle[i]=ang
end
months={"J","F","M","A","M","J","J","A","S","O","N","D"}
--arc line
cairo_arc(cr,ycx,ycy,60,adeg(60),adeg(60+ang))
cairo_stroke(cr)
--arc marks
for i=0,12 do
x,y=pt(ycx,ycy,60,60+((angle[i] or 0)))
cairo_move_to(cr,x,y)
x,y=pt(ycx,ycy,56,60+((angle[i] or 0)))
cairo_line_to(cr,x,y)
cairo_stroke(cr)
end
--month letters
for i=1,12 do
x,y=pt(ycx,ycy,68,60+((120/12)*i)-(120/24))
text({y=y,x=x,t=months[i],hj="c",vj="m"})
end--for
--year text
font({fs=16})
ytx,yty=pt(ycx,ycy,30,60+60)
text({x=ytx,y=yty,t=string.upper(os.date("%y")),hj="c",vj="m"})
font({fs=12})
text({x=ytx-4,y=yty-10,t="20",hj="c",vj="n"})
--indicator
cairo_set_line_width(cr,2)
hexcolor({c=0xffffff})
today=tonumber(os.date("%j"))-1
ypx,ypy=pt(ycx,ycy,55,60+(120*(today/td)))
cairo_move_to(cr,ycx,ycy)
cairo_line_to(cr,ypx,ypy)
cairo_stroke(cr)
--center circle
hexcolor({c=0xffffff,a=0}) -- couleur cercle centre aiguille
cairo_arc(cr,centx,centy,5,0,2*math.pi)
cairo_stroke(cr)
--hand calculations #######################################################
hours=tonumber(os.date("%I"))
-- convert hours to seconds
h_to_s=hours*60*60
minutes=tonumber(os.date("%M"))
-- convert minutes to seconds
m_to_s=minutes*60
-- get current seconds
seconds=tonumber(os.date("%S"))
-- DRAW HOUR HAND
-- get hours minutes seconds as just seconds
hsecs=h_to_s+m_to_s+seconds
-- calculate degrees for each second
hsec_degs=hsecs*(360/(60*60*12))
--call hand drawing function
--hexcolor({c=0xccaa7a,a=0.8})
hexcolor({c=0xff0000,a=0}) -- aiguilles
cairo_set_line_width(cr,2)
hands(
centx,--string or coodinate for clock center x
centy,--string or coodinate for clock center y
hsec_degs,--string or value for hand degrees
70,--string or value for hand length (radius)
3,--set hand center width in pixels
3,--set hand mid width in degrees
0,--set hand end width in pixels, 0=a point
0.9--number from 0 to 1 as a propotion of total hand length, ie 0.5 is exact middle distance
)
--[[hands(
centx,--string or coodinate for clock center x
centy,--string or coodinate for clock center y
hsec_degs+180,--string or value for hand degrees
30,--string or value for hand length (radius)
6,--set hand center width in pixels
18,--set hand mid width in degrees
0,--set hand end width in pixels, 0=a point
.8--number from 0 to 1 as a propotion of total hand length, ie 0.5 is exact middle distance
)--]]
--MINUTES HAND
--hexcolor({c=0xdac09b,a=0.8})
hands(
150,--string or coodinate for clock center x
150,--string or coodinate for clock center y
360*((m_to_s+seconds)/(60*60)),--string or value for hand degrees
99,--string or value for hand length (radius)
3,--set hand center width in pixels
3,--set hand mid width in degrees
2,--set hand end width in pixels, 0=a point
0.9--number from 0 to 1 as a propotion of total hand length, ie 0.5 is exact middle distance
)
--[[hands(
200,--string or coodinate for clock center x
200,--string or coodinate for clock center y
180+(360*((m_to_s+seconds)/(60*60))),--string or value for hand degrees
30,--string or value for hand length (radius)
4,--set hand center width in pixels
18,--set hand mid width in degrees
0,--set hand end width in pixels, 0=a point
0.8--number from 0 to 1 as a propotion of total hand length, ie 0.5 is exact middle distance
)--]]
--#########################################################################################################
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end--end main function
--this function draws hands
function hands(clock_centerx,clock_centery,degrees,length,hand_center_width,hand_mid_width,hand_end_width,distance_to_mid)
--draw_middle
--calc start point
xs,ys=pt(clock_centerx,clock_centery,hand_center_width,degrees-90)
cairo_move_to(cr,xs,ys)
x1,y1=pt(clock_centerx,clock_centery,length*distance_to_mid,degrees-(hand_mid_width/2))
cairo_line_to (cr,x1,y1)
x2,y2=pt(clock_centerx,clock_centery,length,degrees)
cairo_arc(cr,x2,y2,hand_end_width,(degrees+180)*(math.pi/180),(degrees)*(math.pi/180))
--cairo_line_to (cr,x2,y2)
x3,y3=pt(clock_centerx,clock_centery,length*distance_to_mid,degrees+(hand_mid_width/2))
cairo_line_to (cr,x3,y3)
--calc end point
xe,ye=pt(clock_centerx,clock_centery,hand_center_width,degrees+90)
cairo_line_to (cr,xe,ye)
cairo_arc(cr,clock_centerx,clock_centery,hand_center_width,(degrees)*(math.pi/180),(degrees+180)*(math.pi/180))
cairo_fill(cr)
end
function adeg(deg)
return(math.pi/180)*(deg-90)
end
function pt(px,py,prad,pdeg)
local ppo=(math.pi/180)*pdeg
local px1=px+prad*(math.sin(ppo))
local py1=py-prad*(math.cos(ppo))
return px1,py1
end
function font(fontt)
local name=fontt.f or default_font_name or "mono"
local size=fontt.fs or default_font_size or 12
local face=fontt.ff or default_font_face or "n"
if face=="n" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_NORMAL)
elseif face=="b" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_BOLD)
elseif face=="i" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_ITALIC,CAIRO_FONT_WEIGHT_NORMAL)
elseif face=="bi" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_ITALIC,CAIRO_FONT_WEIGHT_BOLD)
end
cairo_set_font_size(cr,size)
end
function hexcolor(hexcolort)
local col=hexcolort.c or default_hex_color or 0xffffff
local a=hexcolort.a or default_alpha or 1
local r,g,b=((col/0x10000) % 0x100)/255,((col/0x100) % 0x100)/255,(col % 0x100)/255
cairo_set_source_rgba(cr,r,g,b,a)
end
function rgbcolor(rgbcolort)
local r=rgbcolort.r or default_red or 1
local g=rgbcolort.g or default_green or 1
local b=rgbcolort.b or default_blue or 1
local a=rgbcolort.a or default_alpha or 1
cairo_set_source_rgba(cr,r,g,b,a)
end
function text(textt)
local x=textt.x or 100
local y=textt.y or 100
local t=textt.t or "set txt"
local hj=textt.hj or default_horizontal_justify or "l"
local vj=textt.vj or default_vertical_justify or "n"
local r=textt.r or default_rotation or 0
cairo_text_extents(cr,t,extents)
local wx=extents.x_advance
local wd=extents.width
local hy=extents.height
local bx=extents.x_bearing
local by=extents.y_bearing+hy
--hl-- l=left, c=center, r=right
if hj=="l" then
xa=x-bx
rad=0
elseif hj=="c" then
xa=x-((wx-bx)/2)-bx
rad=(wx-bx)/2
elseif hj=="r" then
xa=x-wx
rad=wx-bx
else
print ('hj not set correctly for text: '..t..' - "l", "c" or "r"')
xa=0
rad=0
end
--vj-- n=normal, nb=normal-ybearing, m=middle, mb=middle-ybearing, t=top
if vj=="n" then
ya=y
rad2=0
ry=by
elseif vj=="nb" then
ya=y-by
rad2=-by
ry=by
elseif vj=="m" then
ya=y+((hy-by)/2)
rad2=((hy-by)/2)
ry=((hy-by)/2)-by
elseif vj=="mb" then
ya=y+(hy/2)-by
rad2=(hy/2)-by
ry=((hy-by)/2)-by
elseif vj=="t" then
ya=y+hy-by
rad2=hy-by
ry=0+by
else
print ('vj not set correctly for text: '..t..' - "n", "nb", "m", "mb" or "t"')
ya=0
rad2=0
ry=0
end
--rotation
if r~=0 then
local x2,y2=pt(x,y,rad2,r-180)
local x1,y1=pt(x2,y2,rad,r-90)
cairo_save (cr)
cairo_translate (cr,x1,y1)
cairo_rotate(cr,(math.pi/180)*r)
cairo_show_text (cr,t)
cairo_stroke (cr)
cairo_restore (cr)
else
cairo_move_to (cr,xa,ya)
cairo_show_text (cr,t)
cairo_stroke (cr)
end--if ro
--set non local variables to nil
xa=nil;ya=nil;rad=nil;rad2=nil;ry=nil
end--function text ###################################################################
<img src="/upload/capture_deecran_2023-05-08_09-45-41.png" alt="capture_deecran_2023-05-08_09-45-41" title="capture_deecran_2023-05-08_09-45-41" />
Conkyrc
Code :
conky.config = {
-- — Conky settings — #
background = true,
update_interval = 1,
total_run_times = 0,
net_avg_samples = 2,
cpu_avg_samples = 1,
no_buffers = true,
imlib_cache_size = 0,
top_cpu_separate = false,
-- draw_shades = true,
draw_graph_borders = true,
--draw_borders = true,
draw_outline = false,
-- — Window specifications — #
own_window = true,
own_window_type = normal,
own_window_transparent = false,
own_window_hints = 'undecorated,skip_taskbar,skip_pager,below',
own_window_argb_visual = true,
own_window_argb_value = 00, -- 60
own_window_colour = '000000',
double_buffer = true,
minimum_width = 260,
maximum_width = 260, minimum_height = 240,
alignment = 'top_right',
border_inner_margin = 10,
gap_x = 35,
gap_y = 835,
-- — Text settings — #
use_xft = true,
font = 'Ubuntu:size=8',
override_utf8_locale = true,
default_color = '#FFFFFF',
color0 = '#ff0000',
color1 = '#AEEEEE',
color2 = '#6495ee',
color3 = '#0ab1ff', -- Light Blue
color4 = '#4682B4', -- Steel Blue
color5 = '#9FB6CD', -- Slate Grey
color6 = '#000000', -- Black
color7 = '#888888', -- Grey
default_bar_width=100,
default_bar_height=2,
lua_load = '~/.conky/lua/image.lua',
};
conky.text = [[${exec ~/.conky/conky-spotify/scripts/cover.sh}${voffset -20}
${alignc}${color3}SPOTIFY $color
${alignc}${exec ~/.conky/conky-spotify/scripts/artist.sh}${execi 10 ~/.conky/conky-spotify/scripts/title.sh > ~/.conky/conky-spotify/titre}
${alignc}${if_match "${exec sed -n '1p' ~/.conky/conky-spotify/titre}" == "Advertisement"}Publicité ${else}${exec ~/.conky/conky-spotify/scripts/title.sh}${endif}
${alignc}${exec ~/.conky/conky-spotify/scripts/position.sh} ${execbar 2,160 ~/.conky/conky-spotify/scripts/marens_bare.sh} $color3}${exec ~/.conky/conky-spotify/scripts/duree.sh}
${if_match "${execi 2 sed -n '1p' $HOME/.conky/conky-spotify/current/current.txt}" == ""}${lua fDrawImage ~/.conky/conky-spotify/pub.png 50 65 180 180}${else}${lua fDrawImage ~/.conky/conky-spotify/current/current.png 50 65 180 180}${endif}
${voffset 170}$color
${hr 1}
${voffset -200}
]];
cover.sh
artist.sh
title.sh
album.sh
id.sh
imgurl.sh
duree.sh
position.sh
marens_bare.sh
Tout ce beau monde donne ceci .