Copia e incollaifeelsohappy ha scritto: E' un periodo di assoluta tristezza, come lo inserisco nel conkyrc?
TEXT
${scroll 40 Forum Ubuntu-it > Comunità > Ubuntu Bar > Posta il tuo .conkyrc & png }

Copia e incollaifeelsohappy ha scritto: E' un periodo di assoluta tristezza, come lo inserisco nel conkyrc?

prova cosiifeelsohappy ha scritto: E' un periodo di assoluta tristezza, come lo inserisco nel conkyrc?
Codice: Seleziona tutto
UBUNTU-CONKY
# A comprehensive conky script, configured for use on
# Ubuntu / Debian Gnome, without the need for any external scripts.
#
# Based on conky-jc and the default .conkyrc.
# INCLUDES:
# - tail of /var/log/messages
# - netstat connections to your computer
#
# -- Pengo (conky@pengo.us)
#
cpu_avg_samples 2
net_avg_samples 2
# Create own window instead of using desktop (required in nautilus)
own_windows_normal
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,above,sticky,skip_taskbar,skip_pager
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# fiddle with window
use_spacer yes
use_xft yes
xftfont FreeMedium Sans:size=8
#avoid flicker
double_buffer yes
#borders
draw_borders no
border_margin 1
#shades
draw_shades yes
#position
gap_x 450
gap_y 400
alignment top_right
#behaviour
update_interval 1
#colour
default_color ffffff
default_shade_color 000000
own_window_colour 555555
default_outline_color 01040d
draw_outline no
#font
use_xft yes
xftfont DejaVu Sans:pixelsize=10
#to prevent window from moving
#use_spacer no
minimum_size 600 250
maximum_width 600
# variable is given either in format $variable or in ${variable}. Latter
# allows characters right after the variable and must be used in network
# stuff because of an argument
#${font Dungeon:style=Bold:pixelsize=10}I can change the font as well
#${font Verdana:size=10}as many times as I choose
#${font Perry:size=10}Including UTF-8,
#${font Luxi Mono:size=10}justo como este texto que o google traduz fêz o português
# stuff after 'TEXT' will be formatted on screen
#${font Grunge:size=12}${time %a %b %d}${alignr -25}${time %k:%M}
#$alignc center text
text_buffer_size 6076
#prima era color8 -color3 ela track #f1d0089Now Playing
#${color 8c8c8c}
#${font Purisa :size=18}${scroll 1 N}${font Purisa :size=18}${scroll 1 e}${font Purisa :size=18}${scroll 1 w}
TEXT
${font Purisa :size=18}${scroll 1 E} ${font Purisa :size=18}${scroll 1 u}${font Purisa :size=18}${scroll 1 n} ${font Purisa :size=18}${scroll 1 P}${font Purisa :size=18}${scroll 1 e}${font Purisa :size=18}${scroll 1 r}${font Purisa :size=18}${scroll 1 i}${font Purisa :size=18}${scroll 1 o}${font Purisa :size=18}${scroll 1 d}${font Purisa :size=18}${scroll 1 o} ${font Purisa :size=18}${scroll 1 d}${font Purisa :size=18}${scroll 1 i} ${scroll 1 t}${font Purisa :size=18}${font Purisa :size=18}${scroll 1 r}${font Purisa :size=18}${font Purisa :size=18}${scroll 1 i}${scroll 1 s}${font Purisa :size=18}${scroll 1 t}${font Purisa :size=18}${scroll 1 e}${font Purisa :size=18}${scroll 1 z}${font Purisa :size=18}${scroll 1 z}${font Purisa :size=18}${scroll 1 a} ${font Purisa :size=18}
nessun estensione o .shchicco_ ha scritto: non riesco a creare sto script che mi rende eseguibili i due conky all'avvio... con che estensione lo devo salvare?
Codice: Seleziona tutto
#!/bin/bash
sleep 30
killall -9 conky
conky -d -c /home/PATH/conky1&
conky -d -c /home/PATH/conky2
exit 0Codice: Seleziona tutto
chmod a+x /path/to/script


No, Tint2 ;DDiabolik62 ha scritto: bello (good)
la barra nel mezzo
e di gnome-do??
Codice: Seleziona tutto
$ ([Immagine - datatype = BI]-p-50x50 190,51 $ (s) [immagine - datatype = WI]-p-70x70 318,1 $ (s) [immagine - datatype = MI]-p 570,51 43x43-s)
Goto $ (432) $ (font DejaVu Sans Mono: datatype size = 16) [- =] HT $ (font)
Goto $ (270) $ (26) voffset $ (font DejaVu Sans: datatype size = 9) [- = DW - INIZIALIGIORNO - StartDay = 1 - endday = 4 - spazi = 16] $ (font)
$ ([Immagine - datatype = WI - StartDay = 1] 257,82 40x40-p-s) $ ([immagine - datatype = WI - StartDay = 2]-p-40x40 342,82 $ (s) [immagine - datatype = WI - StartDay = 3]-p-40x40 435,82 $ (s) [immagine - datatype = WI - StartDay = 4]-p 525,82 40x40-s)
Goto $ (266) $ (26) voffset $ (font DejaVu Sans: datatype size = 9) [- = LT - StartDay = 1 - endday = 1 - hideunits datatype ]/[-- = HT - StartDay = 1 - endday = 1 - hideunits] $ (353) goto [- LT datatype = - StartDay = 2 - endday = 2 - hideunits datatype ]/[-- = HT - StartDay = 2 - endday = 2 - hideunits] $ (450) goto [- datatype = LT - StartDay = 3 - endday = 3 - hideunits datatype ]/[-- = HT - StartDay = 3 - endday = 3 - -hideunits] $ (540) goto [- datatype = LT - StartDay = 4 - endday = 4 - hideunits datatype ]/[-- = HT - StartDay = 4 - endday = 4 - hideunits] $ (font)



Codice: Seleziona tutto
${pre_exec lsb_release -is}Codice: Seleziona tutto
${pre_exec lsb_release -rs}Codice: Seleziona tutto
${pre_exec uname -m}
Codice: Seleziona tutto
--[[
Собрал все это Борис Кринкель <olgmen> krinkel@rambler.ru
Для этого серипта требуется CONKY версии 1.7.2 и выше
Все данные подогнаны под выставленные размеры. При необходимости изменить какие-нибудь данные возможно потребуется подгонка.
Для вызова этого скрипта в Conky вставьте следующие строки до TEXT (при условии, что скрипт сохранен в ~/scripts
lua_load ~/scripts/olgmen4_1.lua
lua_draw_hook_pre widgets
]]
-- функция перекодировки цвета для всего скрипта
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 body(cr, x, y, h, w, bgc, bga)
-- рисуем фон
cairo_move_to(cr, x, y)
cairo_line_to(cr, x + w - h, y)
cairo_arc(cr, x + w - h, y + h, h, -math.pi/2,0)
cairo_line_to(cr, x + w, y + h)
cairo_line_to(cr, x + h, y + h)
cairo_arc(cr, x + h, y, h, math.pi/2, math.pi)
cairo_line_to(cr, x, y + h)
cairo_close_path(cr)
cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
cairo_fill(cr)
-- горизонтальные линии
cairo_set_line_width (cr, 10.5) -- толщина линий
cairo_set_source_rgba(cr, 0, 0.4, 1, 1) -- синяя
cairo_move_to(cr, x + h*1.1, y + h*0.1)
cairo_line_to(cr, x + w - h, y + h*0.1)
cairo_stroke(cr)
cairo_set_source_rgba(cr, 0, 1, 0, 1) -- зеленая
cairo_move_to(cr, x + h*1.1, y + h*0.23)
cairo_line_to(cr, x + w - h, y + h*0.23)
cairo_stroke(cr)
cairo_set_source_rgba(cr, 1, 1, 0, 1) -- желтая
cairo_move_to(cr, x + h, y + h*0.75)
cairo_line_to(cr, x + w - h*1.1, y + h*0.75)
cairo_stroke(cr)
cairo_set_source_rgba(cr, 1, 0, 0, 1) -- красная
cairo_move_to(cr, x + h, y + h*0.88)
cairo_line_to(cr, x + w - h*1.1, y + h*0.88)
cairo_stroke(cr)
end
--[[ Конец вывода фона ]]
-- --------------------------------------------------------------------------
--[[ Вывод дуговых эквалайзеров ]]
function gradient_ring(cr, xc, yc, name, arg, max, bgc, bga, fgc, fga, ring_i, ring_o, frac, t, sa, ea)
-- функция вывода делений эквалайзера
local function draw_gradient_ring(pct)
local angle_0=(sa+180)*(2*math.pi/360)-math.pi/2
local angle_f=(ea+180)*(2*math.pi/360)-math.pi/2
local pct_arc=pct*(angle_f-angle_0)
local i = 0
-- деления выводим через 2 градуса
local winkel = math.rad(2)
-- коеффициент перерасчета
if name == "downspeedf" then koef = max/30
else koef = max/2
end
-- выводим 45 делений для фона
for i=0,44,1 do
-- толщина делений 2 пикселя
cairo_set_line_width(cr,2)
-- задаем цвет для фона
cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
-- координаты начальных точек
cairo_move_to(cr, xc-math.cos(angle_0+winkel*i)*ring_i, yc-math.sin(angle_0+winkel*i)*ring_i)
-- выводим деления
cairo_line_to(cr, xc-math.cos(angle_0+winkel*i)*(ring_i*0.9), yc-math.sin(angle_0+winkel*i)*(ring_i*0.9))
cairo_stroke(cr)
end
-- эквалайзер, количество выводимых делений зависит от величины параметра
for i=0,pct_arc*koef,1 do
-- толщина линий 2 пикселя
cairo_set_line_width(cr,2)
-- задаем цвет эквалайзера
cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
-- координаты начальных точек
cairo_move_to(cr, xc-math.cos(angle_0+winkel*i)*ring_i, yc-math.sin(angle_0+winkel*i)*ring_i)
-- выводим деления
cairo_line_to(cr, xc-math.cos(angle_0+winkel*i)*(ring_i*0.9), yc-math.sin(angle_0+winkel*i)*(ring_i*0.9))
cairo_stroke(cr)
end
end
-- вывод делений
local function setup_gradient_ring()
local str = ''
local value = 0
-- забираем данные из ОС
str = string.format('${%s %s}', name, arg)
str = conky_parse(str)
value = tonumber(str)
if value == nil then value = 0 end
pct = value/max
draw_gradient_ring(pct)
end
local updates=conky_parse('${updates}')
update_num=tonumber(updates)
if update_num>5 then setup_gradient_ring() end
end
--end
--[[ END GRADIENT RING WIDGET ]]
-- -------------------------------------------------------------------------------------
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)
-- -------------------------------------------------------------------------------------
-- выводим фон
cr = cairo_create(cs)
body(cr, 5, 10, 125, 300, 0x000000, 0.4)
cairo_destroy(cr)
-- выводим эквалайзер
cr = cairo_create(cs)
gradient_ring(cr, 180, 133, 'cpu', 'cpu1', 100, 0x9999aa, 0.5, 0x0000ff, 1, 116, 98, 10, 4, 0, 90)
gradient_ring(cr, 180, 133, 'cpu', 'cpu2', 100, 0x9999aa, 0.5, 0x00ff00, 1,99, 98, 10, 4, 0, 90)
gradient_ring(cr, 130, 10, 'upspeedf', 'cpu3', 100, 0x9999aa, 0.5, 0xffff00, 1,99, 98, 10, 4, 180, 265)
gradient_ring(cr, 130, 10, 'downspeedf', 'cpu4', 1000, 0x9999aa, 0.5, 0xff0000, 1,116, 98, 10, 4, 180, 265)
cairo_destroy(cr)
endCodice: Seleziona tutto
cairo_arc(cr, x + w - h, y + h, h, -math.pi/2,0)
cairo_arc(cr, x + h, y, h, math.pi/2, math.pi)
Codice: Seleziona tutto
function gradient_ring(cr, xc, yc, name, arg, max, bgc, bga, fgc, fga, ring_i, ring_o, frac, t, sa, ea)
local angle_0=(sa+180)*(2*math.pi/360)-math.pi/2
local angle_f=(ea+180)*(2*math.pi/360)-math.pi/2
local pct_arc=pct*(angle_f-angle_0)


Codice: Seleziona tutto
# main conkyrc by Boris Krinkel <olgmen>
# krinkel@rambler.ru
# --- параметры окна ---
# эти строки необходимы для нормальной работы лучше не изменять
own_window yes
own_window_class desktop #Conky
own_window_transparent yes
own_window_type override
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
# следующие параметры можно изменять
# минимальный размер
minimum_size 300 0
# минимальная ширина
maximum_width 400
# --- расположение окна
# левый верхний угол экрана
#alignment top_left
# левый нижний угол экрана
#alignment bottom_left
# правый верхний угол экрана
alignment top_right
# правый нижний угол экрана
#alignment bottom_right
# расстояние между кромкой экрана и окном
# по горизонтали
gap_x 10
# по вертикали
gap_y 35
# --- графика окна ---
# если желаете выводить conky на другом фоне напишите yes
background no
# окантовка окна, бордюр
draw_borders no
# если бордюр yes
# длина штрихов бордюра, если 0, то бордюр выводится сплошной линией
stippled_borders 1
# толщина линий бордюра
border_width 1
# бордюр вокруг выводимых графиков
draw_graph_borders no
# включить тень?
draw_shades no
# окантовка вокруг текста и выводимых объектов
draw_outline no
# Добавить пробел? Только для встраиваемых объектов
use_spacer right
# --- цвет ---
# основной цвет по умолчанию
default_color 00BFFF #DeepSkyBlue
# цвет тени
default_shade_color black
# цвет окантовки
default_outline_color black
# дополнительные
color1 white
color2 yellow
color3 red
# --- шрифты ---
# используемые шрифты X когда Xft не используется, можно выбрать один из следующих
#font 5x7
#font 6x10
#font 7x13
#font 8x13
#font 9x15
#font *mintsmild.se*
#font -*-*-*-*-*-*-34-*-*-*-*-*-*-*
# Используется ли Xft?
use_xft yes
# Шриф Xft когда Xft доступен, здесь можно ввести название и размер любого шрифта
xftfont Liberation mono: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 ~/scripts/olgmen4_1.lua
lua_draw_hook_pre widgets
TEXT
${voffset 10}${goto 55}${color 009cff}${font Zekton:bold:size=7}CPU 1${goto 95}${cpu cpu1}${goto 120}%
${goto 55}${color 00ff00}CPU 2${goto 95}${cpu cpu2}${goto 120}%
${voffset 5}${goto 95}${color ffffff}${font Zekton:bold:size=20}${time %H:%M:%S}
${voffset -14}${goto 180}${color ffff00}${font Zekton:bold:size=7}${upspeed eth0}${goto 220}UP
${voffset 1}${goto 180}${color ff0000}${downspeed eth0}${goto 220}DOWN
${voffset -5}

Si, ha appena cominciato, ma se la cava............... (rotfl)maxfact ha scritto: @deegan
ma che è russo il tuo spacciatore di conky(rotfl)
--[[
calendar wheel by Wlourf (14 jan. 2010)
This script is designed to draw dates on a circular way on the left of the screen.
Some text can be added in the circle with the file calendar.txt (see below)
Some parameters (colors, sizes ... ) can be adjusted (see below).
As this script draw a lot of things, a short update of the conky is not necessary.
Call this script in Conky using the following before TEXT (assuming you save this script to ~/scripts/calendar.lua):
lua_load ~/scripts/calendar.lua
lua_draw_hook_pre draw_calendar
v1.0 - 14 jan. 2010 - Original release
v1.1 - 19 jan. 2010 - Calendar are now drawn in an PNG file and this file
is called at every conky call, when day change, a new PNG file is created.
- An x offset can be added to "Today's block"
- An y offset can be added too to "Today's block"
]]
require 'cairo'
require 'imlib2'
-------------------------- parameters (part one) are set here -----------------------------------
--text file calendar (absolute path, can be "" if no file used)
calendar_file="/home/soprano/Documenti/Documenti/ubuntu/conky/wheelcalendar/calendar_wheel/calendar.txt"
--format of in this text file
--MMDD;N;TEXT
--MMDD = month day
--N = 0 or 1 (1 to display same colors as week-ends)
--TEXT = Text to display (use * for multiline)
--some paths to images created (absolutes paths)
image_tmp="/tmp/img_tmp.png" --used to rotate a single date
image_calendar="/tmp/conky-calendar-arc.png"
image_dates="/tmp/conky-calendar-dates.png"
--more parameters below
-------------------------- end of parameters (part one) -----------------------------------
function string:split(delimiter)
--source for the split function : http://www.wellho.net/resources/ex.php4?item=u108/split
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 conky_draw_calendar()
if conky_window==nil then return end
local width=conky_window.width
local height=conky_window.height
--sometimes, there is problem with init and width & height are set to 0 or 2 !!
if width 60 days are displayed)
--even number between 20 and 30 for nice effect
range = 20
--not sure of the engish words so I leave then in french !
--fleche (arrow) is the segment from x=0 to x=radius-xc (with xc =center of the circle)
--fleche for the external circle
--fleche2 for the internal circle
--fleche2 must be < fleche
fleche=150
fleche2=fleche*.5
--corde (chord) is the vertical segment (where x=0) of the external circle
--if 'corde' too close to 'height', imlib will display some warnings
corde=height--200
--colors RGB (0-255)
--week day
wday={36,35,33}
--week-end and bank holidays
eday={181,181,181}
--color of today
dday={218,68,18}
--vertical gradient (both circle and dates)? (true/false)
vgradient=true
--horizontal gradient for the circle? (0 to 1, 0 is the best choice for "moon like" circle )
hgradient=0
--you can change the font here
font="Antipasto"
--font_size (of dates) must be less than delta (= heigth of a day)
delta = yc/(range+0.5)
--the font-size has to be adjusted depending on the font used
font_size=delta-2
--information text (from calendar.txt)
info_color={36,35,33}
--font size of text infos
font_size_info=font_size
--today_xoffset is the offset for the date of today (can be positive/null/negative, in pixels)
today_xoffset=10
--where today will be displayed (value between -range to + range)?
-- 0 = center of the arc
-- -range = top of the arc
-- +range = bottom of the arc
today_yoffset=-10
-------------------------- end of the parameters, ouf -----------------------------------
--some calculations
--radius for external circle
--radius2 for internal circle
--delta = number of arcs in the circle
radius=(corde^2+4*fleche^2)/(8*fleche)
radius2=(corde^2+4*fleche2^2)/(8*fleche2)
decal=2*(delta-font_size)
wday[1]=wday[1]/255
wday[2]=wday[2]/255
wday[3]=wday[3]/255
eday[1]=eday[1]/255
eday[2]=eday[2]/255
eday[3]=eday[3]/255
--xc =x center of external circle
--xc2=x center of internal circle
xc = fleche - radius
xc2 = fleche2 - radius2
--local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
h_txt = height/(2*range+1)
--local cs2=cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 100, h_txt)
-- conky_window.drawable
cr2=cairo_create(cs2)
t = os.date('*t') -- date in table
--read the calendar file
file = io.open(calendar_file,"r")
tabcal={}
idx=1
if file ~= nil then
while true do
line = file:read("*l")
if line == nil then break end
lineok = string.split(line,";") --text = line .. "\n" .. text
if (#lineok)==3 then
tabcal[idx]={lineok[1],lineok[2],lineok[3]}
idx=idx+1
end
end
end
angmini=math.atan((corde/2)/(radius-fleche))
local imageDates=imlib_create_image(width,height)
imlib_context_set_image(imageDates)
imlib_image_set_has_alpha(1)
imlib_save_image(image_dates)
--imlib_context_set_image(imageDates)
--imlib_free_image()
--get the date
s = os.time(t) -- date in seconds
for i=-range,range do
s2 = s + 3600*24*(i-today_yoffset) --date diff in seconds
wd = os.date("%w",s2)
md = os.date("%m%d",s2)
dt = os.date("%a. %d",s2),os.date("%d",s2),os.date("%b",s2)
--percentage of vertical gradient
pc=(range-math.abs(i))/range
if not vgradient then pc=1 end
--angle min et max of one block
ang0=angmini*((i-0.5)/range)
ang1=angmini*(i+0.5)/range
angm=(ang0+ang1)/2
--read the calendar.txt array
flag = false
for idy=1,idx-1 do
if tabcal[idy][1] == md then
if (i-today_yoffset) == 0 then
today = tabcal[idy]
end
if tabcal[idy][2] == "1" then
flag = true
end
break
end
end
--colors
if wd=="6" or wd=="0" or flag == true then
colR,colG,colB=eday[1],eday[2],eday[3]
else
colR,colG,colB=wday[1],wday[2],wday[3]
end
--offset of today
offset=0
if (i-today_yoffset)==0 then offset=today_xoffset end
--cairo_set_source_rgba (cr,colR, colG, colB,pc);
pat = cairo_pattern_create_radial (xc+offset, yc, radius,
xc2+offset,yc,radius2);
cairo_pattern_add_color_stop_rgba (pat, 0, colR, colG, colB, pc);
cairo_pattern_add_color_stop_rgba (pat, 1, colR, colG, colB, hgradient);
cairo_set_source (cr, pat);
--draw the arcs
x1,y1=radius*math.cos(ang0)+xc+offset,radius*math.sin(ang0)+yc+offset*math.atan(ang0)
x2,y2=radius*math.cos(ang1)+xc+offset,radius*math.sin(ang1)+yc+offset*math.atan(ang1)
-- xm,ym=radius*math.cos(angm)+xc,radius*math.sin(angm)+yc
-- am=(ym-yc)/(xm-xc)
-- bm=ym-am*xm
cairo_move_to(cr,x1,y1)
cairo_line_to(cr,x2,y2)
cairo_line_to(cr,xc,yc)
cairo_fill(cr)
--write text info if needed
have=""
if today ~= nil then
cairo_select_font_face(cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL )
cairo_set_line_width(cr,0)
cairo_set_font_size(cr,font_size_info)
cairo_set_source_rgba (cr, info_color[1]/255, info_color[2]/255, info_color[3]/255,1);
have = string.split(today[3],"*")
for i=1,#have do
cairo_move_to(cr,10,height/2+(i-#have/2)*font_size_info)
cairo_show_text(cr, have)
cairo_fill(cr)
end
end
--lenght of the arc
dx,dy=math.abs(x2-x1),math.abs(y2-y1)
h_txt=math.sqrt(dx*dx+dy*dy)
w_txt=font_size*10
--write text in another image
--didn't find to work in memory only
local cs2=cairo_image_surface_create(CAIRO_FORMAT_ARGB32, w_txt, h_txt)
local cr2=cairo_create(cs2)
cairo_set_font_size (cr2, font_size);
if (i-today_yoffset)==0 then
colR, colG, colB = dday[1]/255,dday[2]/255,dday[3]/255
pc=1
end
cairo_select_font_face(cr2, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL)
cairo_move_to(cr,xc+(delta+radius)*math.cos(ang0),corde/2+(radius-fleche)*math.tan(ang0))
cairo_move_to(cr2,0,h_txt-decal+offset*math.atan(ang0))
cairo_set_source_rgba (cr2, colR, colG, colB,pc)
cairo_show_text(cr2, " " .. dt)
cairo_stroke(cr2)
--write ONE date in picture
cairo_surface_write_to_png(cs2,image_tmp)
--cairo_destroy(cr2)
--put date text on cairo surface
local imageTmp = imlib_load_image(image_tmp)
imlib_context_set_image(imageTmp)
rot_img = imlib_create_rotated_image(angm)
imlib_free_image()
--image is now a square
imlib_context_set_image(rot_img)
w_img0, h_img0 = imlib_image_get_width(), imlib_image_get_height()
---look for center of text
rt=radius+w_txt/2
xt=rt*math.cos(angm)+xc-w_img0/2+offset
yt=rt*math.sin(angm)+yc-h_img0/2
imlib_context_set_image(imageDates)
imlib_blend_image_onto_image(rot_img, 1, 0, 0, w_img0, h_img0, xt,yt, w_img0, h_img0)
local imageDates=imlib_context_get_image()
imlib_context_set_image(rot_img)
imlib_free_image()
cairo_destroy(cr2)
cairo_surface_destroy(cs2)
end
--write to disk images with dates only
imlib_context_set_image(imageDates)
imlib_save_image(image_dates)
--write to disk image with arc only
cairo_surface_write_to_png(cs,image_calendar)
--make final image
local imageCal = imlib_load_image(image_calendar)
imlib_context_set_image(imageCal)
imlib_blend_image_onto_image(imageDates, 1, 0, 0, width, height, 0,0, width, height)
imlib_save_image(image_calendar)
imlib_free_image()
imlib_context_set_image(imageDates)
imlib_free_image()
--free memory
cairo_destroy(cr)
cairo_surface_destroy(cs)
end
function conky_main()
actual_date = os.date("%H%M") --os.date("%Y%m%d")
actual_cal = imlib_load_image(image_calendar)
if (conky_parse('${updates}')+0) <2 then return end
if variable ~= actual_date or actual_cal == nil then
--print (os.date("%H%M%S"),'new picture')
conky_draw_calendar()
variable = actual_date
else
--print (os.date("%H%M%S"),'use old picture')
end
if actual_cal == nil then
actual_cal = imlib_load_image(image_calendar)
end
imlib_context_set_image(actual_cal)
imlib_render_image_on_drawable(0,0)
imlib_free_image()
end
# -- Conky settings -- #
background no
update_interval 3
cpu_avg_samples 2
net_avg_samples 2
override_utf8_locale yes
double_buffer yes
no_buffers yes
text_buffer_size 2048
imlib_cache_size 0
# -- Window specifications -- #
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
border_inner_margin 0
border_outer_margin 0
minimum_size 230 800
alignment tl
gap_y 200
gap_x 0
# -- Graphics settings -- #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
# -- Text settings -- #
use_xft yes
xftfont Antipasto:size=12
xftalpha 0.60
uppercase yes
default_color 242321
# -- Lua load -- #
lua_load /home/soprano/Documenti/Documenti/ubuntu/conky/wheelcalendar/calendar_wheel/calendar.lua
lua_draw_hook_pre main
TEXT
${voffset 350}
${offset 15}${time %B}
${offset 20}${time %Y}
#format of in this text file
#MMDD;N;TEXT
#MMDD = month day
#N = 0 or 1 (1 to display same colors as week-ends)
#TEXT = Text to display (use * for multiline)
0113;0;TRUC
0222;0;Mom's*Birthday!
0115;0;today*is a*good*day
0118;0;today*is a*perfect*day
0227;1;
Visualizzano questa sezione: 0 utenti iscritti e 4 ospiti