You are not logged in.
>Some purposefully missing features:
1. wireless network signal strength (update time interval scalable on dBm)
2. hdd temperature
3. randomly generated wifi mac-address (entropy purposes)
4. external prometheus' spaceships complete info when entering lv221
Ky are especially interested in the 4th.
Sector11, hmmmm!?
Hex Pxls, please.
Do the honors
Awesome quote!
Offline
I am not sure what you want?
but just in case:
1. wireless network signal strength (update time interval scalable on dBm)
→ I do not have wireless on my computer - I am connected by cable.
2. hdd temperature
→ Index» Scripts, Tutorials & Tips» hddtemp vs. drivetemp in conky
3. randomly generated wifi mac-address (entropy purposes)
→ no wifi on my computer - cannot help
4. external prometheus' spaceships complete info when entering lv221
→ do not know what you mean
All I wanted was the wallpaper you showed with your conky.
This one.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Hello
A last one, I've been trying to get it to work since Mageia 5.
I finally succeeded with just one error in the console but it doesn't affect the conky.
I changed the blue temperature to 6495ee but I can't find the rgba code for the compass rose needle.
Le script
--[[ 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-openmeteo/Suisse/barographe/temp}')+40,
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 = 236,
end_angle = 133,
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 = "/home/romuald/.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, -- длина стрелки
width_of_arrows = 6, -- ширина стрелки
},
{ -- давление
name = "pression",
arg = conky_parse('${exec sed -n 1p $HOME/.conky/barometr/pre}'),
max = 80,
start_angle = 240,
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 == "N" then t.arg = 180.0 end
if t.arg == "NNE" then t.arg = 202.5 end
if t.arg == "NE" 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 == "SE" then t.arg = 315.0 end
if t.arg == "SSE" then t.arg = 337.5 end
if t.arg == "S" then t.arg = 360.0 end
if t.arg == "SSO" then t.arg = 22.5 end
if t.arg == "SO" 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 == "NO" 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)
-- рисуем стрелку
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
cairo_pattern_add_color_stop_rgba (pat, 0, 0, 0, 0.9, 0.7)
cairo_pattern_add_color_stop_rgba (pat, 0, 0, 0, 0.9, 0.7)
else
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, 0.5)
end
cairo_set_source (cr, pat)
cairo_fill (cr)
cairo_pattern_destroy (pat)
end
@+
Last edited by loutch (2023-04-18 15:36:39)
Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX
Offline
@loutch
-- рисуем стрелку
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/12, t.x, t.y, t.radius*t.length_of_arrows)
if t.name == "wind" then
-- для ветра устанавливаем цвет синий переходящий в красный (не очень заметно)
cairo_pattern_add_color_stop_rgba (pat, 0, 0, 0, 1, 0.8) -- синий
cairo_pattern_add_color_stop_rgba (pat, 1, 1, 0, 0, 0.7) -- красный
else
-- для давления красный
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, 0.7) -- красный
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]]--
barometr_v.0.1.lua by olgmen 07.12.2010
Offline
Been looking at that and puzzling over it for hours!
I'm getting dizzy and totally lost!
---
J'ai regardé ça et j'ai réfléchi pendant des heures !
Je deviens étourdi et totalement perdu!
---
Habe mir das angeschaut und stundenlang darüber gegrübelt!
Mir wird schwindelig und ich bin total verloren!
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
@loutch.
tu veux dire ?
$ python3 rgb.py 6495ee
#6495ee => rgb(0.39, 0.58, 0.93)
you mean?
$ ./rgb.py 6495ee
#6495ee => rgb(0.39, 0.58, 0.93)
peut-être
maybe
cairo_pattern_add_color_stop_rgba (pat, 1, 0.39, 0.58, 0.93, 0.5)
?
Last edited by unklar (2023-04-18 18:02:31)
Offline
@loutch
name = "/home/romuald/.conky/barometr/images/wind_rose.png", -- путь к картинке
replace
name = os.getenv ('HOME')..'/.conky/barometr/images/wind_rose.png', -- путь к картинке
Offline
Re
@il.harun
done
@+
Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX
Offline
@loutch
barometr_v.0.1.lua by olgmen 07.12.2010
AHA!!! Did not see earlier.
olgmen did/does some really nice stuff.
Thanks for sharing.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
I've been playing with olgman's clock - the bright white back was hard on my eyes:
The conky: /media/5/Conky/olgmen-clock/olgmen-clock.conky
# pkill -xf "conky -c /media/5/Conky/olgmen-clock/olgmen-clock.conky" &
# Begin Window Settings
# main conkyrc by Boris Krinkel <olgmen>
# krinkel@rambler.ru
# --- параметры окна ---
# эти строки необходимы для нормальной работы лучше не изменять
own_window yes
own_window_class Conky
own_window_transparent yes
own_window_type normal #override
own_window_hints undecorated,below,skip_taskbar,skip_pager #sticky,
#own_window_title with lua
# следующие параметры можно изменять
# минимальный размер
minimum_size 250 250
# минимальная ширина
maximum_width 450
# --- расположение окна
# левый верхний угол экрана
#alignment top_left
# левый нижний угол экрана
#alignment bottom_left
# правый верхний угол экрана
alignment top_right
# правый нижний угол экрана
#alignment bottom_right
# расстояние между кромкой экрана и окном
# по горизонтали
gap_x 50 #5
# по вертикали
gap_y 30
# --- графика окна ---
# если желаете выводить conky на другом фоне напишите yes
background no
# окантовка окна, бордюр
draw_borders no
# если бордюр yes
# длина штрихов бордюра, если 0, то бордюр выводится сплошной линией
stippled_borders 5
# толщина линий бордюра
border_width 1
# бордюр вокруг выводимых графиков
draw_graph_borders no
# включить тень?
draw_shades no
# окантовка вокруг текста и выводимых объектов
draw_outline no
# Добавить пробел? Только для встраиваемых объектов
use_spacer right
# --- цвет ---
# основной цвет по умолчанию
# default_color DeepSkyBlue
# цвет тени
# default_shade_color black
# цвет окантовки
# default_outline_color black
# дополнительные
# color1 white
# color2 yellow
# color3 red
default_color DCDCDC #Gainsboro
color0 C0C0C0 #Silver
color1 778899 #LightSlateGray
color2 FAEBD7 #AntiqueWhite
color3 87CEFA #LightSkyBlue
color4 48D1CC #MediumTurquoise
color5 FFDEAD #NavajoWhite
color6 00BFFF #DeepSkyBlue
color7 B0E0E6 #PowderBlue
color8 FFD700 #Gold
color9 CD5C5C #IndianRed
# --- шрифты ---
# используемые шрифты X когда Xft не используется, можно выбрать один из следующих
#font 5x7
#font 6x10
#font 7x13
#font 8x13
#font 9x15
#font *mintsmild.se*
#font -*-*-*-*-*-*-34-*-*-*-*-*-*-*
# Используется ли Xft?
use_xft yes
# Шриф Xft когда Xft доступен, здесь можно ввести название и размер любого шрифта
#xftfont Archangelsk:size=9
xftfont fira code medium:size=9
# яркость шрифта при испоьзовании шрифтов Xft
xftalpha 1
# выводить весь текст прописными буквами
uppercase no
# использовать кодировку UTF8? ПРИМЕЧАНИЕ: требуется Xft
override_utf8_locale yes
# --- следующие данные необходимы для работы
# обновление в секундах не имеет смысла ставить больше 2
# при выводе времени в секундах необходимо значение 1 и менее
update_interval 0.5
# время работы программы до её выключения
# установите 0 для работы программы без остановки
total_run_times 0
# двойная буфферизация (требуется для flicker, может не работать)
double_buffer yes
# вычитать буферизацию файловой системы из используемой памяти?
no_buffers yes
# количество cpu
cpu_avg_samples 2
# number of net samples to average
net_avg_samples 2
imlib_cache_size 0
short_units yes
pad_percents 2
text_buffer_size 2048
imlib_cache_size 0
#--- LUA ---#
lua_load /media/5/Conky/olgmen-clock/olgmen5.lua #calendar3_1.lua
lua_draw_hook_pre widgets
## TEXT
## ${voffset 300}
TEXT
U ${utime %H%M%S}${alignr 5}${time %s} UET
UP ${uptime_short}${alignr 5}${execi 60 /media/5/Conky/scripts/swatch.sh} SWATCH
I added a stippled border to see the edges to play with spacing, they are off now.
I added 4 different types of times to the corners.
UTC | Universal Epoch Time
Up time (short) | SWATCH
The swatch.sh file, you need to install: bc
#!/bin/bash
# beats - swatch time
# by brontosaurusrex - https://forums.bunsenlabs.org/viewtopic.php?pid=39518#p39518
# http://www.timeanddate.com/time/internettime.html
# https://www.swatch.com/en/internettime/
# https://en.wikipedia.org/wiki/Swatch_Internet_Time#Calculation_from_UTC.2B1
# required
command -v bc >/dev/null 2>&1 || { echo "I need bc" ; exit 1; }
# UTC to variables
export TZ=GMT-1 # Not sure why is this minus and not plus
read h m s <<<$(date "+%H %M %S")
# echo $h $m $s
# (UTC+1seconds + (UTC+1minutes * 60) + (UTC+1hours * 3600)) / 86.4
# btw: beats smaller than one are not in the standard
# bc is "rounding down", which seems to be the correct way in this case
# h=23
# m=59
# s=59
beats=$(bc -l <<< "scale=0; ($s + ($m * 60) + (($h) * 3600)) / 86.4")
echo "@$beats"
and olgmen's lua script: olgmen5.lua
--[[
Conky Widgets by olgmen (2010)
Скрипт позволяет выводить в окно CONKY часы с часовым механизмом
для запуска необходимо ввести до TEXT сдедующие строки
#--- LUA ---
lua_load ~/scripts/olgmen5.lua
lua_draw_hook_pre widgets
при условии, что скрипт olgmen5.lua сохранен в папке ~/scripts
]]
require 'cairo'
--[[ CLOCK WIDGET ]]
function clock(cr, x, y, s, bgc, bga, fgc, fga)
-- функция перекодировки цвета
function rgb_to_r_g_b(colour,alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
-- назначаем толщину выводимых линий
local s_th = 2
-- перехватываем данные часы, минуты, секунды
local hours=os.date("%H")
local mins=os.date("%M")
local secs=os.date("%S")
-- назначаем максимальные значения
secs_arc=(2*math.pi/60)*secs
mins_arc=(2*math.pi/60)*mins
hours_arc=(2*math.pi/12)*hours+mins_arc/12
-- рисуем циферблат
local radius = s/2
local m_x,m_y = x + s/2, y + s/2
-- рисуем черный фон основы часов
-- задаем границы внешней окружности
cairo_arc(cr, m_x,m_y, radius, 0, math.rad(360))
-- задаем цвет
cairo_set_source_rgba(cr, 0, 0, 0, 1)
-- окрашиваем
cairo_fill_preserve(cr)
-- завершаем действие
cairo_stroke(cr)
-- ----------------------------------------------------------------
-- рисуем верхнюю шестерню
local i = 0
-- зубцы шестерни располагаем через 15 градусов
local winkel = math.rad(15)
-- рисуем обод шестерни
cairo_arc(cr, m_x,m_y-s*0.275, radius*0.26, 0, math.rad(360))
-- задаем ширину обода
cairo_set_line_width(cr,s_th*4)
-- задаем цвет
cairo_set_source_rgba(cr, 1, 0.75, 0, 1)
-- выводим рисунок
cairo_stroke(cr)
-- рисуем пустые места между зубцами шестерни, что бы показать сцепление зубцов
-- будем выводить 24 зубца
for i=0,23,1 do
-- задаем ширину
cairo_set_line_width(cr,5)
-- задаем начальные точки
cairo_move_to(cr, m_x-math.cos(secs+winkel*i)*(radius*0.25), m_y-s*0.275-math.sin(secs+winkel*i)*(radius*0.25))
-- задаем конечные точки
cairo_line_to(cr, m_x-math.cos(secs+winkel*i)*(radius*0.3), m_y-s*0.275-math.sin(secs+winkel*i)*(radius*0.3))
-- задаем цвет
cairo_set_source_rgba(cr, 0, 0, 0, 1)
-- выводим рисунок
cairo_stroke(cr)
end
-- рисуем спицы шестерни
local i = 0
-- спицы располагаем через 60 градусов
local winkel = math.rad(60)
-- будем выводить 6 спиц
for i=0,5,1 do
cairo_set_line_width(cr,s_th*1.5)
cairo_move_to(cr, m_x-math.cos(secs+winkel*i)*(radius*0.25), m_y-s*0.275-math.sin(secs+winkel*i)*(radius*0.25))
cairo_line_to(cr, m_x-math.cos(secs+winkel*i), m_y-s*0.275-math.sin(secs+winkel*i))
cairo_set_source_rgba(cr, 1, 0.75, 0, 1)
cairo_stroke(cr)
end
-- --------------------------------------------------
-- рисуем левую шестерню
local i = 0
local winkel = math.rad(15)
cairo_arc(cr, m_x-s*0.2,m_y+s*0.1, radius*0.3, 0, math.rad(360))
cairo_set_line_width(cr,s_th*4)
cairo_set_source_rgba(cr, 1, 0.75, 0, 1)
cairo_stroke(cr)
for i=0,23,1 do
cairo_set_line_width(cr,5)
cairo_move_to(cr, m_x-s*0.2-math.cos(secs+winkel*i)*(radius*0.29), m_y+s*0.1-math.sin(secs+winkel*i)*(radius*0.29))
cairo_line_to(cr, m_x-s*0.2-math.cos(secs+winkel*i)*(radius*0.34), m_y+s*0.1-math.sin(secs+winkel*i)*(radius*0.34))
cairo_set_source_rgba(cr, 0, 0, 0, 1)
cairo_stroke(cr)
end
local i = 0
local winkel = math.rad(60)
for i=0,5,1 do
cairo_set_line_width(cr,s_th*1.5)
cairo_move_to(cr, m_x-s*0.2-math.cos(secs+winkel*i)*(radius*0.29), m_y+s*0.1-math.sin(secs+winkel*i)*(radius*0.29))
cairo_line_to(cr, m_x-s*0.2-math.cos(secs+winkel*i), m_y+s*0.1-math.sin(secs+winkel*i))
cairo_set_source_rgba(cr, 1, 0.75, 0, 1)
cairo_stroke(cr)
end
-- -----------------------------------------------------
-- рисуем центральную шестерню
local i = 0
local winkel = math.rad(15)
-- рисуем обод
cairo_arc(cr, m_x,m_y, radius*0.24, 0, math.rad(360))
cairo_set_line_width(cr,s_th*2)
cairo_set_source_rgba(cr, 1, 0.75, 0, 1)
cairo_stroke(cr)
for i=0,23,1 do
cairo_set_line_width(cr,s_th)
cairo_move_to(cr, m_x-math.sin(secs+winkel*i)*(radius*0.25), m_y-math.cos(secs+winkel*i)*(radius*0.25))
cairo_line_to(cr, m_x-math.sin(secs+winkel*i)*(radius*0.3), m_y-math.cos(secs+winkel*i)*(radius*0.3))
cairo_set_source_rgba(cr, 1, 0.75, 0, 1)
cairo_stroke(cr)
end
local i = 0
local winkel = math.rad(60)
for i=0,5,1 do
cairo_set_line_width(cr,s_th*1.5)
cairo_move_to(cr, m_x-math.sin(secs+winkel*i)*(radius*0.25), m_y-math.cos(secs+winkel*i)*(radius*0.25))
-- рисуем спицы
cairo_line_to(cr, m_x-math.sin(secs+winkel*i), m_y-math.cos(secs+winkel*i))
cairo_set_source_rgba(cr, 1, 0.75, 0, 1)
cairo_stroke(cr)
end
-- ---------------------------------------
-- рисуем циферблат
-- задаем границы внешней окружности
cairo_arc(cr, m_x,m_y, radius, 0, math.rad(360))
-- начинаем новое задание
cairo_new_sub_path(cr)
-- задаем границы внутренней окружности
cairo_arc(cr, m_x,m_y, radius*0.5, 0, math.rad(360))
-- даем задание окрасить пространство между окружностями
cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD)
-- задаем цвет
cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
-- окрашиваем
cairo_fill_preserve(cr)
-- завершаем действие
cairo_stroke(cr)
-- рисуем внешнюю окружность
cairo_arc(cr, m_x,m_y, radius, 0, math.rad(360))
-- задаем толщину линии
cairo_set_line_width(cr,6)
-- задаем цвет линии
cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
-- рисуем
cairo_stroke(cr)
-- прозрачный "корпус часов"
cairo_arc(cr, m_x, m_y, radius*1.15, 0, 2*math.pi)
cairo_set_source_rgba(cr, 0.5, 0.5, 0.5, 0.8)
cairo_set_line_width(cr,1)
cairo_stroke(cr)
local border_pat=cairo_pattern_create_linear(m_x, m_y - radius*1.15, m_x, m_y + radius*1.25)
cairo_pattern_add_color_stop_rgba(border_pat,0,0,0,0,0.7)
cairo_pattern_add_color_stop_rgba(border_pat,0.3,1,1,1,0)
cairo_pattern_add_color_stop_rgba(border_pat,0.5,1,1,1,0)
cairo_pattern_add_color_stop_rgba(border_pat,0.7,1,1,1,0)
cairo_pattern_add_color_stop_rgba(border_pat,1,0,0,0,0.7)
cairo_set_source(cr,border_pat)
cairo_arc(cr, m_x, m_y, radius*1.1, 0, 2*math.pi)
cairo_close_path(cr)
cairo_set_line_width(cr, radius*0.15)
cairo_stroke(cr)
-- вывод часовых делений
local i = 0
local winkel = math.rad(30)
for i=0,11,1 do
cairo_set_line_width(cr,s_th*1.5)
cairo_move_to(cr, m_x-math.sin(winkel*i)*radius, m_y-math.cos(winkel*i)*radius)
cairo_line_to(cr, m_x-math.sin(winkel*i)*(radius*0.9), m_y-math.cos(winkel*i)*(radius*0.9))
cairo_fill_preserve(cr)
cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
cairo_stroke(cr)
end
-- вывод минутных делений
local i = 0
local winkel = math.rad(6)
for i=0,59,1 do
cairo_set_line_width(cr,1)
cairo_move_to(cr, m_x-math.sin(winkel*i)*radius, m_y-math.cos(winkel*i)*radius)
cairo_line_to(cr, m_x-math.sin(winkel*i)*(radius*0.9), m_y-math.cos(winkel*i)*(radius*0.9))
cairo_stroke(cr)
end
-- часовые стрелки с тенью, взято из Shadowed clock by wlourf (10 jan. 2010)
function draw_hand(a_trame,arc,arc0,arc1,lg,r,border,rgb)
xx = xc + clock_r*math.sin(arc)*lg
yy = yc - clock_r*math.cos(arc)*lg
x0 = xc + r*math.sin(arc0)
y0 = yc - r*math.cos(arc0)
x1 = xc + r*math.sin(arc1)
y1 = yc - r*math.cos(arc1)
if border ~= nil then
cairo_set_line_width(cr,1)
cairo_set_source_rgba(cr,border[1],border[2],border[3],0.5)
cairo_move_to (cr, x0, y0)
cairo_curve_to (cr, x0, y0, xx, yy, x1, y1)
cairo_arc(cr,xc,yc,r,arc1-math.pi/2,arc0-math.pi/2)
cairo_stroke(cr)
end
-- рисуем тень
cairo_move_to (cr, x0, y0)
cairo_curve_to (cr, x0, y0, xx+shadow_xoffset, yy+shadow_yoffset, x1, y1)
cairo_arc(cr,xc,yc,r,arc1-math.pi/2,arc0-math.pi/2)
pat = cairo_pattern_create_radial (xc, yc, 0, xc, yc, clock_r)
cairo_pattern_add_color_stop_rgba (pat, 0, 0, 0, 0, shadow_opacity)
cairo_pattern_add_color_stop_rgba (pat, 1, 0, 0, 0, 0)
cairo_set_source (cr, pat)
cairo_fill (cr)
-- рисуем стрелки
cairo_move_to (cr, x0, y0)
cairo_curve_to (cr, x0, y0, xx, yy, x1, y1)
cairo_arc(cr,xc,yc,r,arc1-math.pi/2,arc0-math.pi/2)
pat = cairo_pattern_create_radial (xc, yc, clock_r/10, xc, yc, clock_r*lg)
cairo_pattern_add_color_stop_rgba (pat,0, rgb[1], rgb[2], rgb[3], 1)
cairo_pattern_add_color_stop_rgba (pat, 1, 0, 0, 0, 1)
cairo_set_source (cr, pat)
cairo_fill (cr)
cairo_pattern_destroy (pat)
end
-- Здесь вводятся основные данные
-- радиус часов в пикселях, задаем половину диаметра часов
clock_r=s/2
-- координаты центра часов
xc = x+s/2
yc = y+s/2
-- координаты источника света относительно центра часов, 0 - источник света над центром
-- может быть положительным, источник света выше центра, или отрицательным
shadow_xoffset=70
shadow_yoffset=70
-- прозрачность тени, значения от 0 до 1
shadow_opacity=0.5
-- Выводить секундную стрелку, Да - true, Нет - false.
-- При выводе секундной стрелки update_interval в .conkyrc должен быть менее 1 сек.
show_seconds=false
-- Выводить ось стрелок в центре часов, Да - true, Нет - false.
show_dot = true
-- размеры стрелок, первая цифра ширина, вторая - длина
rh,lgh=3,1.2 -- часовая стрелка
rm,lgm=2,1.75 -- минутная стрелка
rs,lgs=1,1.9 -- секундная стрелка
-- забираем данные из ОС
-- local hours=os.date("%I")
-- local mins=os.date("%M")
-- local secs=os.date("%S")
-- расчет угла движения стрелок
gamma = math.pi/2-math.atan(rs/(clock_r*lgs))
secs_arc=(2*math.pi/60)*secs
secs_arc0=secs_arc-gamma
secs_arc1=secs_arc+gamma
gamma = math.pi/2-math.atan(rm/(clock_r*lgm))
mins_arc=(2*math.pi/60)*mins + secs_arc/60
mins_arc0=mins_arc-gamma
mins_arc1=mins_arc+gamma
gamma = math.pi/2-math.atan(rh/(clock_r*lgh))
hours_arc=(2*math.pi/12)*hours+mins_arc/12
hours_arc0=hours_arc-gamma
hours_arc1=hours_arc+gamma
-- вывод стрелок
draw_hand(alpha_trame,hours_arc,hours_arc0,hours_arc1,lgh,rh,{0,0,0},{1,1,1})
draw_hand(alpha_trame,mins_arc,mins_arc0,mins_arc1,lgm,rm,{0,0,0},{.9,.9,.9})
if show_seconds then
draw_hand(alpha_trame,secs_arc,secs_arc0,secs_arc1,lgs,rs,{0,0,0},{.8,.8,.8})
end
-- рисуем ось стрелок
if show_dot then
lg_shadow_center=3
radius=math.min(rh,rm,rs)*0.75
if radius<1 then radius=1 end
ang = math.atan(shadow_yoffset/shadow_xoffset)
-- тень от оси cairo_pattern_add_color_stop_rgba(border_pat,0,0,0,0,0.7)
cairo_pattern_add_color_stop_rgba(border_pat,0.3,0.5,1,1,0)
cairo_pattern_add_color_stop_rgba(border_pat,0.5,0.5,1,1,0)
cairo_pattern_add_color_stop_rgba(border_pat,0.7,0.5,1,1,0)
cairo_pattern_add_color_stop_rgba(border_pat,1,0,0,0,0.7)
cairo_set_source(cr,border_pat)
cairo_arc(cr, m_x, m_y, radius*1.125, 0, 2*math.pi)
cairo_close_path(cr)
cairo_set_line_width(cr, radius*0.25)
cairo_stroke(cr)
gamma = -math.atan(1/lg_shadow_center)
ang0=ang-gamma
ang1=ang+gamma
end
end
--[[ END CLOCK ]]
--------------------------------
function conky_widgets()
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)
---------------------------------
--[[ CLOCK ]]
cr = cairo_create(cs)
-- ORIGINAL:
-- clock(cr, 25, 50, 200, 0xffffff, 0.9, 0x000000, 1)
-- clock(cr, 31, 30, 200, 0xffffff, 0.9, 0x000000, 1)
-- cr, ←→, ↑↓, size,centre , alpha, outter ring, alpha
-- clock(cr, 31, 30, 200, 0x0eefff, 0.5, 0xff0000, 0.5)
-- clock(cr, 31, 30, 200, 0xffdead, 0.4, 0xffdead, 0.3)
clock(cr, 31, 30, 200, 0x69aaff, 0.4, 0xCD5C5C, 0.5)
-- опции: x, y, s, bgc, bga, fgc, fga
-- "x" координаты по горизонтали центра часов
-- "y" координаты по вертикали центра часов
-- "s" диаметр часов
-- "bgc" цвет фона
-- "bga" яркость фона
-- "fgc" цвет графики
-- "fga" яркость графики
cairo_destroy(cr)
end
It's the coding at the end where I played with colours.
1 → 2 →
3 → 4 →
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
SEX.... errrr NICE!!
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Made five steampunk clocks. Just copied the LUA script to each one and tweaked it a little.
Images and code if requested.
The LUA scripts are just a modified 12|24 hour clock by mrpeachy:
--[[drawing a clock in conkyrc
by mrpeachy - 12 March 2010
Edited by Sector11 2023-04-18
lua_load /media/5/Conky/LUA/steampunk.mugen.lua
lua_draw_hook_post main
TEXT
]]
I used "lua_draw_hook_post main" to get the clock hands over the ${uptime_short} time.
OR
I used "lua_draw_hook_post main" to get the ${uptime_short} time under the clock hands.
Take your pick.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Hello
@loutch.
tu veux dire ?
$ python3 rgb.py 6495ee #6495ee => rgb(0.39, 0.58, 0.93)
you mean?
$ ./rgb.py 6495ee #6495ee => rgb(0.39, 0.58, 0.93)
peut-être
maybecairo_pattern_add_color_stop_rgba (pat, 1, 0.39, 0.58, 0.93, 0.5)
?
Ddanke mein freund
ich hatte dies in das Skript geschrieben
(pat, 0.6, 0.4, 0.6, 0.9, 0.8)
@+
Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX
Offline
WOW, what a creative commotion here!
Thank you both for these ingenious configurations.
I love looking at the forum early in the morning and seeing ideas like this.
Offline
@loutch
wrong (pat, 0.6, 0.4, 0.6, 0.9, 0.8)
correct (pat, 0, 0.4, 0.6, 0.9, 0.8) or (pat, 1, 0.4, 0.6, 0.9, 0.8)
needle_settings: see pressure
original
needle_settings = { -- вывод стрелок
{
name = "wind", -- направление ветра
arg = conky_parse('${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ UUWW wind_dir}'),
max = 360,
length_of_arrows = 1.3, -- длина стрелки
width_of_arrows = 8, -- ширина стрелки
},
{ -- давление
name = "pressure",
arg = conky_parse('${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ UUWW pressure}')/1.33322-725,
max = 80,
start_angle = 240,
end_angle = 480,
length_of_arrows = 2.75,
width_of_arrows = 4,
},
my
needle_settings = { -- вывод стрелок
{
name = "wind", -- направление ветра
--arg = conky_parse('${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ UUWW wind_dir}'),
--arg = conky_parse("${execi 20 sed -n 5p /tmp/1b1_bar_en/curr_cond | awk '{print $1}'}"),
------------------------------------------
---- стрелка показывает куда дует ветер, используя WSW ,n,ese и т.д.
--
arg = conky_parse("${execi 20 sed -n '5p' /tmp/1b1_bar_en/curr_cond}"),
--test-- arg = conky_parse('WSW'),
---- стрелка показывает откуда дует ветер, используя цифровое значения направления ветра-> deg.
--arg = conky_parse("${execi 20 sed -n 11p /tmp/cache_YR/curr_cond}"),
--test-- arg = conky_parse('30'),
max = 360,
length_of_arrows = 1.3, -- длина стрелки
width_of_arrows = 8, -- ширина стрелки
},
{ -- давление
name = "pressure",
--arg = conky_parse('${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ UUWW pressure}')/1.33322-725,
--arg = math.ceil(conky_parse("${execi 20 sed -n 8p /tmp/1b1_bar_en/curr_cond | cut -c -4|awk '{print ($1*0.7500637-725)}'|cut -c -3}")),
------------------------------------------
--
arg = conky_parse("${execi 20 sed -n 8p /tmp/1b1_bar_en/curr_cond |awk '{print int($2*0.7500637-725)}'}"),
--test--arg = conky_parse('1026')/1.33322-725,
--test--arg = conky_parse('1026'),
max = 80,
start_angle = 240,
end_angle = 480,
length_of_arrows = 2.75,
width_of_arrows = 3,
},
you
needle_settings = { -- вывод стрелок
{
name = "vent", -- направление ветра
arg = conky_parse('${exec sed -n 1p $HOME/.conky/barometr/dir}'),
max = 360,
length_of_arrows = 1, -- длина стрелки
width_of_arrows = 6, -- ширина стрелки
},
{ -- давление
name = "pression",
arg = conky_parse('${exec sed -n 1p $HOME/.conky/barometr/pre}'),
max = 80,
start_angle = 240,
end_angle = 480,
length_of_arrows = 2.75,
width_of_arrows = 3,
},
Last edited by il.harun (2023-04-19 11:18:31)
Offline
upd.
This is the visible part of the scale with 765 mmHg in the middle.
mmHg
<------ 80 ------>
725 765 805 mmHg
...|------------------------|------------------------|....
mbar
<------ 80 ------>
966 1019 1073 mbar
...|------------------------|------------------------|....
mbar
arg = conky_parse('${exec sed -n 1p $HOME/.conky/barometr/pre}')-966,
(you can add a correction, depending on the height above sea level)
Offline
Ladies and gentlemen,
If you are going to post in your mother tongue and translate to another language for a specific person that is perfectly fine.
However please translate to English as well for the rest of the forum users. There is nothing wrong with having a post with two or more languages as long as English is one of them
After all; this is an English forum.
https://lingva.ml/ does it very nicely.
Thank you.
= = =
Mesdames et Messieurs,
Si vous allez publier dans votre langue maternelle et traduire dans une autre langue pour une personne spécifique, c'est parfaitement bien.
Cependant, veuillez également traduire en anglais pour le reste des utilisateurs du forum. Il n'y a rien de mal à avoir un poste avec deux langues ou plus tant que l'anglais est l'une d'entre elles
Après tout; c'est un forum anglais.
https://lingva.ml/ le fait très bien.
Merci.
= = =
Meine Damen und Herren,
Wenn Sie in Ihrer Muttersprache posten und für eine bestimmte Person in eine andere Sprache übersetzen, ist das vollkommen in Ordnung.
Jedoch übersetzen Sie bitte auch ins Englische für den Rest der Forumsnutzer. Es ist nichts falsch daran, einen Beitrag in zwei oder mehr Sprachen zu haben, solange Englisch eine davon ist
Schließlich; dies ist ein englisches Forum.
https://lingva.ml/ macht es sehr gut.
Danke schön.
= = =
For il.harun who has always posted in English anyway
Дамы и господа,
Если вы собираетесь размещать сообщения на своем родном языке и переводить на другой язык для конкретного человека, это совершенно нормально.
Однако пожалуйста, переведите и на английский язык для остальных пользователей форума. Нет ничего плохого в публикации на двух или более языках, если одним из них является английский.
После всего; это английский форум.
https://lingva.ml/ делает это очень хорошо.
Спасибо.
I cannot do Russian characters but I do say: privet, spasibo and pozhaluysta on my cellphone occasionally.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline