You are not logged in.

#21 2015-11-08 14:33:31

mrneilypops
The BL Scrot.Moe Guy
From: luxembourg
Registered: 2015-09-30
Posts: 577
Website

Re: Conky - Calendars / Clocks / Time

@Temetka
Sure  wink

# For commands above TEXT check:
# http://conky.sourceforge.net/config_settings.html
#
# For commands available below TEXT check:
# http://conky.sourceforge.net/variables.html

# Bunsen Labs Conky help threads
# http://crunchbang.org/forums/viewtopic.php?pid=371424#p371424

# beta tested by: smacz
# Enjoy! :)

# pkill -xf "conky -q -c $HOME/.config/conky/BL-Default.conkyrc" &
###  Begin Window Settings  #####################
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,skip_taskbar,skip_pager,sticky
own_window_colour 000000
own_window_class Conky
own_window_title bunsenlabs sdi+liq

### ARGB can be used for real transparency
### NOTE that a composite manager is required for real transparency.
### This option will not work as desired (in most cases) in conjunction with
### own_window_type normal
# own_window_argb_visual yes # Options: yes or no

### When ARGB visuals are enabled, this use this to modify the alpha value
### Use: own_window_type normal
### Use: own_window_transparent no
### Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
# own_window_argb_value 50

minimum_size 220 0  ### width | height
maximum_width 300

gap_x 20	### left | right
gap_y 45	### up | down

alignment tr
#######################  End Window Settings  ###
###  Font Settings  #############################
# Use Xft (anti-aliased font and stuff)
use_xft yes
xftfont bitcora:size=8
#ftfont Liberation Sans:size=9

# Alpha of Xft font. Must be a value at or between 1 and 0 ###
xftalpha 1
# Force UTF8? requires XFT ###
override_utf8_locale yes

uppercase no
#########################  End Font Settings  ###
###  Colour Settings  ###########################
draw_shades no #yes
default_shade_color 000000

draw_outline no # amplifies text if yes
default_outline_color 000000

#default_color 656667 # Waldorf original colour
#default_color 7a7a7a # Flame  & Bunsen Grey
#default_color 929292 # Labs Grey
default_color C0C0C0 # Silver
color0 B0E0E6 # PowderBlue
color1 778899 # LightSlateGray
color2 D8BFD8 # Thistle
color3 9ACD32 # YellowGreen
color4 FFA07A # LightSalmon
color5 FFDEAD # NavajoWhite
color6 00BFFF # DeepSkyBlue
color7 5F9EA0 # CadetBlue
color8 BDB76B # DarkKhaki
color9 CD5C5C # IndianRed
#######################  End Colour Settings  ###
###  Borders Section  ###########################
draw_borders no
# Stippled borders?
stippled_borders 5
# border margins
border_inner_margin 5
border_outer_margin 0
# border width
border_width 2
# graph borders
draw_graph_borders yes #no
#default_graph_size 15 40
#######################  End Borders Section  ###
###  Miscellaneous Section  #####################
# Boolean value, if true, Conky will be forked to background when started.
background yes

# Adds spaces around certain objects to stop them from moving other things
# around, this only helps if you are using a mono font
# Options: right, left or none
use_spacer none

# Default and Minimum size is 256 - needs more for single commands that
# "call" a lot of text IE: bash scripts
text_buffer_size 6144

# Subtract (file system) buffers from used memory?
no_buffers yes

# change GiB to G and MiB to M
short_units yes

# Like it says, ot pads the decimals on % values
# doesn't seem to work since v1.7.1
pad_percents 2

# Imlib2 image cache size, in bytes. Default 4MiB Increase this value if you use
# $image lots. Set to 0 to disable the image cache.
imlib_cache_size 0

# Use the Xdbe extension? (eliminates flicker)
# It is highly recommended to use own window with this one
# so double buffer won't be so big.
double_buffer yes

#   Maximum size of user text buffer, i.e. layout below TEXT line in config file
#  (default is 16384 bytes)
# max_user_text 16384

# Desired output unit of all objects displaying a temperature. Parameters are
# either "fahrenheit" or "celsius". The default unit is degree Celsius.
# temperature_unit Fahrenheit
##############################################
#  Output
##############################################
TEXT
b u n s e n l a b s   I N F O  $alignr${execp ~/binclock}
${hr}
GMT:$alignr${utime %H:%M}
Host:$alignr$nodename
Uptime:$alignr$uptime

ram:$alignr$mem/$memmax
#Swap usage:$alignr$swap/$swapmax
disk:$alignr${fs_used /}/${fs_size /}
cpu:$alignr${cpu cpu0}%

debian :$alignr${execp cat /etc/debian_version} 
kernel installed : $alignr${kernel}
kernel latest check:$alignr${exec ~/bin/atomfeed.py}
#i3 :$alignr${execp apt-cache policy i3 | grep Installed: | cut -d: -f2}

s h o r t c u t    K E Y S
${hr}
[Alt] + F2${alignr}Run Dialog
[Alt] + F3${alignr}Alt Menu
[Super] + Space${alignr}Main Menu
[Super] + Tab${alignr}Client Menu
[Super] + t${alignr}Terminal
[Super] + f${alignr}File Manager
[Super] + e${alignr}Editor
[Super] + m${alignr}Media Player
[Super] + w${alignr}Web Browser
[Super] + h${alignr}Task Manager
[Super] + l${alignr}Lock Screen
[Super] + v${alignr}Volume Control
[Super] + x${alignr}Logout
[PrtSc]${alignr}Screenshot
${hr}
s i m p l i c i t y   IS THE ULTIMTE SOPHISTICATION
$alignr${font bitcora13:italic:size=6}Leanardo da Vinci

Offline

#22 2015-11-08 18:16:19

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,008

Re: Conky - Calendars / Clocks / Time

nore wrote:

I'm trying to get my head around adding week numbers in the two month calendar.

the old 'cal' app never had the -w option.  So whern you use 'ncal -b' to get the horizontal layout you loose the ncal options that cal didn't have.

     cal [-3hjy] [-A number] [-B number] [[month] year]
     cal [-3hj] [-A number] [-B number] -m month [year]
     ncal [-3bhjJpwySM] [-A number] [-B number] [-s country_code] [[month] year]
     ncal [-3bhJeoSM] [-A number] [-B number] [year]
     ncal [-CN] [-H yyyy-mm-dd] [-d yyyy-mm]

I've checked all my 'calendar' scripts I can't find anything here that does what you want.  sad


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#23 2015-11-08 18:46:14

ceeslans
Member
Registered: 2015-09-30
Posts: 195

Re: Conky - Calendars / Clocks / Time

Temetka wrote:

<snip>
...
On to my post.

This image:
https://forums.mageia.org/de/download/f … &mode=view

Is a killer clock. I took a look at the scripts, but they appear to be in Russian. Can anyone translate them?

Source thread:
https://forums.mageia.org/de/viewtopic. … 523#p24444

have this conky running on my desktop; but somehow the fading future days in the top seem to break out of the conky area:
conky_calendar3.jpg

and I don't know how to set this correctly, either in conkyrc or in the lua file.
was kinda hoping that any of you could have a look where i have gone astray...

conkyrc:

update_interval 1 
#total_run_times 0
double_buffer yes 
no_buffers yes 
cpu_avg_samples 2
net_avg_samples 2 
imlib_cache_size 0 
short_units yes 
pad_percents 2 
text_buffer_size 2048 
imlib_cache_size 0 

background no 
own_window yes
own_window_type desktop
own_window_argb_visual yes
own_window_argb_value 0
own_window_hints undecorated,sticky,skip_taskbar,skip_pager,below
own_window_title Calendar3
own_window_class Calendar3

draw_borders no
#stippled_borders 1
border_width 1
draw_graph_borders no
draw_shades no
draw_outline no 
use_spacer right 

default_color 151515 	#DeepSkyBlue
default_shade_color black 
default_outline_color black
color1 white
color2 yellow 
color3 red 

use_xft yes 
xftfont Sans:pixelsize=9 
xftalpha 0.5 
uppercase no 
override_utf8_locale yes 

minimum_size 350 450
alignment mr 
gap_x 20 
gap_y 20 

#--- LUA ---
lua_load ~/.conky/calendar3/calendar3.lua
lua_draw_hook_pre widgets

TEXT
#

calendar3.lua:

--[[
When assembling the script used data from the following scripts

Conky Widgets by londonali1010 ( 2009) - watches and rings
Conky vertical bar graph by iggykoopa - horizontal and vertical bars
Shadowed clock by wlourf ( 10 jan. 2010 ) - the clock with shadow
calendar wheel by Wlourf ( 14 jan. 2010 ) - Calendar

He collected all this Boris Krinkel <olgmen> krinkel@rambler.ru

To do this requires seripta CONKY version 1.7.2

To call this script in Conky , insert the following lines to the TEXT ( provided that the script is saved in ~/scripts/conky_widgets.lua):
    lua_load ~/scripts/calendar3.lua
    lua_draw_hook_pre widgets
]]

require 'cairo'
require 'imlib2'

--[[ AIR CLOCK WIDGET ]]
--[[ Widget displays the image of the clock with arrows and shadow volume of the arrows .
Some of the settings stored in the widget
]]

function clock(cr, x, y, s, bgc, bga, fgc, fga)

-- color conversion function

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

-- We assign a thickness of output lines

		local s_th = 2

-- draw a face

		local radius = s/2	
		local m_x,m_y = x + s/2, y + s/2
		cairo_set_line_width(cr,6)
		cairo_arc(cr, m_x,m_y, radius, 0, math.rad(360))
		cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
		cairo_fill_preserve(cr)
		cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
		cairo_stroke(cr)

-- transparent " body clock"
	
		cairo_arc(cr, m_x, m_y, radius*1.25, 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.25, m_x, m_y + radius*1)
	
		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.125, 0, 2*math.pi)
		cairo_close_path(cr)
		cairo_set_line_width(cr, radius*0.25)
		cairo_stroke(cr)

-- the output time division

		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*1.3), m_y-math.cos(winkel*i)*(radius*1.3))
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

-- minute withdrawal of divisions

		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

-- Draw division 3 , 6, 9 and 12 hours

		cairo_set_line_width(cr,s_th/2)		-- set line thickness

		cairo_move_to (cr, x + 0.15*s, y + 0.5*s)
		cairo_line_to (cr, x + 0.45*s, y + 0.5*s)
		cairo_move_to (cr, x + 0.55*s, y + 0.5*s)
		cairo_line_to (cr, x + 0.85*s, y + 0.5*s)
		cairo_move_to (cr, x + 0.5*s, y + 0.15*s)
		cairo_line_to (cr, x + 0.5*s, y + 0.45*s)
		cairo_move_to (cr, x + 0.5*s, y + 0.55*s)
		cairo_line_to (cr, x + 0.5*s, y + 0.85*s)
		cairo_stroke(cr)

-- clockwise from the shadow comes from 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

-- draw shadow

		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)

-- draw arrows

		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

-- Here, we introduce the basic data

-- The radius of hours in pixels , specify the diameter of the half hour

		clock_r=s/2

-- coordinates of the center hours

		xc = x+s/2
		yc = y+s/2

-- coordinates of the center of the light hours, 0 - the light source above the center
-- may be positive , the light source above the center or negative

		shadow_xoffset=70
		shadow_yoffset=70

-- transparent shadow, values from 0 to 1

		shadow_opacity=0.5

-- Per second hand , yes - true, no - false.
-- In the derivation of the second hand in update_interval .conkyrc should be less than 1 sec .

		show_seconds=true

-- Per axis arrows in the center of the clock , yes - true, no - false.

		show_dot = true

-- the size of the arrows , the width of the first digit , the second - the length

		rh,lgh=3,1.2	-- hour hand
		rm,lgm=2,1.75	-- minute hand
		rs,lgs=1,1.9	-- second hand

-- We pick up the data from the OS

		local hours=os.date("%I")
		local mins=os.date("%M")
		local secs=os.date("%S")

-- calculation of the angle of movement of arrows

		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

-- concluded arrows

		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

-- Draw arrows axis

		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)

-- the shadow of the axis

		gamma = -math.atan(1/lg_shadow_center)
		ang0=ang-gamma
		ang1=ang+gamma

-- the shadow of the arrows

		if shadow_xoffset<0 and shadow_yoffset>0 then
		ang0=ang0+math.pi
		ang1=ang1+math.pi
		ang=ang+math.pi
		end

		if shadow_yoffset<0 and shadow_xoffset>0 then
		ang0=ang0-math.pi/2
		ang1=ang1-math.pi/2
		ang=ang-math.pi/2
		end

		if shadow_yoffset<0 and shadow_xoffset<0 then
		ang0=ang0-math.pi/2
		ang1=ang1-math.pi/2
		ang=ang-math.pi/2
		end

		x0 = xc + radius*math.sin(ang0)
		y0 = yc - radius*math.cos(ang0)
		xx = xc + radius*math.sin(ang+math.pi/2)*lg_shadow_center
		yy = yc - radius*math.cos(ang+math.pi/2)*lg_shadow_center
		x1 = xc - radius*math.sin(ang1)
		y1 = yc + radius*math.cos(ang1)

		cairo_move_to(cr,x0,y0)
		cairo_curve_to(cr,x0,y0,xx,yy,x1,y1)
		pat = cairo_pattern_create_radial (xc, yc, 0, xc, yc, radius*4)
		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)

		ang = ang-math.pi/2
		xshad = xc + radius*math.sin(ang)*.5
		yshad = yc - radius*math.cos(ang)*.5

		local ds_pat=cairo_pattern_create_radial(xc, yc, 0, xshad, yshad, radius)
		cairo_pattern_add_color_stop_rgba(ds_pat,0,.9,.9,.9,1)
		cairo_pattern_add_color_stop_rgba(ds_pat,1,0,0,0,1)
		cairo_arc(cr,xc,yc,radius,0,2*math.pi)
		cairo_set_source(cr,ds_pat)
		cairo_fill(cr)

-- gloss paint on glass

		pat = cairo_pattern_create_radial (115.2, 102.4, 25.6, 102.4, 102.4, 128)
		cairo_pattern_add_color_stop_rgba (pat, 0, 1, 1, 1, 0.1)
		cairo_pattern_add_color_stop_rgba (pat, 1, 0, 0, 0, 0.4)
		cairo_set_source (cr, pat)
		cairo_arc (cr, xc, yc, s/2, 0, 2 * math.pi)
		cairo_fill (cr)
		cairo_pattern_destroy (pat)
end

--[[ END AIR CLOCK WIDGET ]]

-- ----------------------------------------------------------------------------------

--[[
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 info 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 png file only if necessary, a short update of the conky can be used.

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 main
	
	
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"
v1.2 - 28 jan. 2010 - Calendar can be drawn on the right side of the conky (but without text info)
	- Calendar is drawn after the second conky refresh only
v1.2a - 29 jan. 2010 - Minor update, picture was refresh every second instead of every day!
]]

--require 'cairo'
--require 'imlib2'

-------------------------- parameters (part one) are set here -----------------------------------

	--text file calendar (absolute path, can be "" if no file used)
	calendar_file=""
	--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-calendar3-arc.png"
	image_dates="/tmp/conky-calendar3-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
--local height = s
--local width = s	
	--sometimes, there is problem with init and width & height are set to 0 or 2 !!
--	if width<3 or height<3 then return end
	
local cs=cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height)
	local cr=cairo_create(cs)
	
	-------------------------- parameters (part two) are set here -----------------------------------

	
	-- vertical center of the circle (height/2 for centered circle)
	local yc=s/2+y
	
	--number of days to display before and after today (i.e. with range = 30 --> 60 days are displayed)
	--even number between 20 and 30 for nice effect
	local range = 11
	
	--not sure of the english 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
	local fleche=125
	local fleche2=fleche*.85
	
	--corde (chord) is the vertical segment (where x=0) of the external circle
	local corde = 1.5*s--height+s/2
			
	--colors RGB (0-255)
	--week day
	local wday={150,150,150}
	--week-end and bank holidays defined in calendar.txt
	local eday={255,200,0}
	--color of today
	local dday={255,255,255}
	
	--vertical gradient (both circle and dates)? (true/false)
	local vgradient=true
	
	--horizontal gradient for the circle? (0 to 1, 0 is the best choice for "moon like" circle )
	local hgradient=0
	
	--you can change the font here
	local font="PT Sans"
	--font_size (of dates) must be less than delta (= heigth of a day)
	local delta = yc/(range+0.5)
	--the font-size has to be adjusted depending on the font used
	local font_size=delta-1
	
	--information text (from calendar.txt)
	local info_color={255,200,0}
	--font size of text infos
	local font_size_info=font_size

	--today_xoffset is the offset for the date of today (can be positive/null/negative, in pixels)
	local today_xoffset=3
	
	--today_yoffset 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
	local today_yoffset=0	-- -9
	
	--display on right side of the screen (true/false)
	local align_right = true

	
	-------------------------- end of the parameters, ouf -----------------------------------

	--some calculations
	--radius for external circle
	--radius2 for internal circle
	--delta = number of arcs in the circle
	local radius=(corde^2+4*fleche^2)/(8*fleche)
	local radius2=(corde^2+4*fleche2^2)/(8*fleche2)
 	local 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
	local xc = fleche - radius	
	local xc2 = fleche2 - radius2
	
	if align_right then 
		xc = width-xc-1.25*s/2
		xc2 = width-xc2-1.25*s/2
	end

	local h_txt = height/(2*range+1)
	
	local t = os.date('*t') -- date in table
	--get the date
	local s = os.time(t) -- date in seconds

	--read the calendar file
	local file = io.open(calendar_file,"r")	
	local tabcal={}	
	local idx=1
	local line,lineok="",""
	if file ~= nil then
		while true do
		 	line = file:read("*l")
		    if line == nil then break end
			lineok = string.split(line,";")
			if (#lineok)==3 then
				tabcal[idx]={lineok[1],lineok[2],lineok[3]}
				idx=idx+1
			end
		end
	end	
	io.close()
	local 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)

	for i=-range,range do
		local s2 = s + 3600*24*(i-today_yoffset) --date diff in seconds

		local wd = os.date("%w",s2)
		local md = os.date("%m%d",s2)
		local dt = os.date("%a. %d %b.",s2),os.date("%d",s2),os.date("%b",s2)

		--percentage of vertical gradient
		local pc = (range-math.abs(i))/range
		if not vgradient then pc=1 end

		--angle min et max of one block
		local ang0 = angmini*(i-0.5)/range
		local ang1 = angmini*(i+0.5)/range
		if align_right then 
			ang0=math.pi-ang0
			ang1=math.pi-ang1
		end
		local angm = (ang0+ang1)/2
		
		--read the calendar.txt array
		local 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
		local colR,colG,colB=0,0,0
		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 
		local offset_x=0
		local way = 1
		if (i-today_yoffset)==0 then 
			if align_right then way =-1 end
			offset_x=today_xoffset*way 
		end

		local pat = cairo_pattern_create_radial (xc+offset_x, yc, radius,
         			xc2+offset_x,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 portion of arc
		if align_right then
			x1,y1=radius*math.cos(ang0)+xc+offset_x,(radius-offset_x)*math.sin(ang0)+yc
			x2,y2=radius*math.cos(ang1)+xc+offset_x,(radius-offset_x)*math.sin(ang1)+yc
		else
			x1,y1=radius*math.cos(ang0)+xc+offset_x,(radius+offset_x)*math.sin(ang0)+yc
			x2,y2=radius*math.cos(ang1)+xc+offset_x,(radius+offset_x)*math.sin(ang1)+yc
		end
		cairo_move_to(cr,x1,y1)
		cairo_line_to(cr,x2,y2)
		cairo_line_to(cr,xc,yc)
		cairo_fill(cr)
		
		--for tests
		if (i-today_yoffset)==0 then
		--cairo_set_source_rgba (cr,1, 0,0,1);
		--cairo_arc(cr,x1,y1,1,0,2*math.pi)
		--cairo_stroke(cr)
		--cairo_arc(cr,xc,yc,radius,0,2*math.pi)
		--cairo_stroke(cr)
		--cairo_set_source_rgba (cr,0, 1, 0,pc);
		--cairo_arc(cr,x2,y2,1,0,2*math.pi)
		--cairo_stroke(cr)
		end

		--write text info if needed, for left-side calendar only
		local have=""
local height = 100 -- расположение текста из calendar.txt

if today ~= nil then
--		if (today ~= nil) and (align_right ~= true) 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+(i-#have/2)*font_size_info)
				cairo_show_text(cr, have[i])
				cairo_fill(cr)
			end
		end	

		--lenght of the arc
		local dx,dy=math.abs(x2-x1),math.abs(y2-y1)
		local h_txt=math.sqrt(dx*dx+dy*dy)
		local w_txt=font_size*10

		--write text in another image for working (rotate) on it
		--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)

		--write ONE date in ONE picture		
		local txt_date = " " .. dt .. " "
		--start the drawing date here in order to get the lenght of the text
		--for right alignement
		cairo_move_to(cr2,0,h_txt-decal)--+offset_x*math.atan(ang0))
		cairo_set_source_rgba (cr2, colR, colG, colB,pc)
		cairo_show_text(cr2, txt_date)

		if align_right then
			local xmax,ymax=cairo_get_current_point(cr2,0,0)
			--don't use local for cs2fit cause local will be just for if .. end section
			--and then surface will not be deleted --> memory leak
			cs2fit = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, xmax, h_txt)
			cr2fit = cairo_create(cs2fit)
			
			cairo_set_font_size (cr2fit, font_size);
			cairo_select_font_face(cr2fit, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL)
			cairo_move_to(cr2fit,0,h_txt -decal)
			cairo_set_source_rgba (cr2fit, colR, colG, colB,pc)
			cairo_show_text(cr2fit, txt_date)
			cairo_stroke(cr2fit)
			cairo_surface_write_to_png(cs2fit,image_tmp)
			
		else
			cairo_stroke(cr2)
			cairo_surface_write_to_png(cs2,image_tmp)
		end
	
		--blend date image on cairo surface
		local imageTmp = imlib_load_image(image_tmp)
		imlib_context_set_image(imageTmp)

		if align_right then
			rot_img = imlib_create_rotated_image(angm+math.pi)
		else
			rot_img = imlib_create_rotated_image(angm)
		end

		imlib_context_set_image(imageTmp)
		imlib_free_image()
	
		--image is now a  square
		imlib_context_set_image(rot_img)
		local w_img0, h_img0 = imlib_image_get_width(), imlib_image_get_height()
		
		---look for center of text
		local rt=radius+w_img0/2
		if align_right then	
			rt=rt-offset_x
		else
			rt=rt+offset_x
		end
		local xt=rt*math.cos(angm)+xc-w_img0/2
		local 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)
		imageDates=imlib_context_get_image()
		imlib_context_set_image(rot_img)
		imlib_free_image()




		if align_right then 
			
			cairo_destroy(cr2fit)
			cairo_surface_destroy(cs2fit)
		end
	
		cairo_destroy(cr2)
		cairo_surface_destroy(cs2)

		cairo_pattern_destroy(pat)
	end --of loop

	--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 calendar()
	--last_date is global 
	local actual_date  = os.date("%Y%m%d") --os.date("%Y%m%d")
	local actual_cal = imlib_load_image(image_calendar)
	if (conky_parse('${updates}')+0) <2  then return end
	if  last_date ~= actual_date or actual_cal == nil then
		--print (os.date("%H%M%S"),'new picture')
		conky_draw_calendar()
		last_date = 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
end
-- [[ END CALENDAR WIDGET ]]

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

--[[ BACKGROUND WIDGET by londonali1010 (2009)]]
function background(cr)
  local w=conky_window.width
  local h=conky_window.height
-- "corner_r" is the radius, in pixels, of the rounded corners. If you don't want rounded corners, use 0.
  local corner_r=45
-- Set the colour of your background.
  local bg_colour=0x000000
-- Set the transparency (alpha) of your background.
  local bg_alpha=0.3

  cairo_move_to(cr,corner_r,0)
  cairo_line_to(cr,w-corner_r,0)
  cairo_curve_to(cr,w,0,w,0,w,corner_r)
  cairo_line_to(cr,w,h-corner_r)
  cairo_curve_to(cr,w,h,w,h,w-corner_r,h)
  cairo_line_to(cr,corner_r,h)
  cairo_curve_to(cr,0,h,0,h,0,h-corner_r)
  cairo_line_to(cr,0,corner_r)
  cairo_curve_to(cr,0,0,0,0,corner_r,0)
  cairo_close_path(cr)

  cairo_set_source_rgba(cr,rgb_to_r_g_b(bg_colour,bg_alpha))
  cairo_fill(cr)
end
--[[ END BACKGROUND WIDGET ]]
-- ----------------------------------------------------------------------
--[[ TEXT WIDGET ]]

	function addzero100(num)

		if tonumber(num) <10 then
		return "00" .. num
		elseif tonumber(num) <100 then
		return "0" .. num
		else
		return num
		end
	end

	function string:split(delimiter)

		local result = { }
		local from  = 1
		local delim_from, delim_to = string.find( self, delimiter, from  )
		while delim_from do
		table.insert( result, string.sub( self, from , delim_from-1 ) )
		from  = delim_to + 1
		delim_from, delim_to = string.find( self, delimiter, from  )
		end
		table.insert( result, string.sub( self, from  ) )
		return result
	end

	function circlewriting(cr, text, font, fsize, radi, horiz, verti, tred, tgreen, tblue, talpha, start, finish, var1)

		local inum=string.len(text)
		range=finish
		deg=(finish-start)/(inum-1)
		degrads=1*(math.pi/180)
		local textcut=string.gsub(text, ".", "%1@@@")
		texttable=string.split(textcut, "@@@")
		for i = 1,inum do
			ival=i
			interval=(degrads*(start+(deg*(i-1))))+var1
			interval2=degrads*(start+(deg*(i-1)))
			txs=0+radi*(math.sin(interval))
			tys=0-radi*(math.cos(interval))
			cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
			cairo_set_font_size (cr, fsize);
			cairo_set_source_rgba (cr, tred, tgreen, tblue, talpha);
			cairo_move_to (cr, txs+horiz, tys+verti);
			cairo_rotate (cr, interval2)
			cairo_show_text (cr, (texttable[i]))
			cairo_rotate (cr, -interval2)
		end
	end

	function circlewritingdown(cr, text, font, fsize, radi, horiz, verti, tred, tgreen, tblue, talpha, start, finish, var1)

		local inum=string.len(text)
		deg=(start-finish)/(inum-1)
		degrads=1*(math.pi/180)
		local textcut=string.gsub(text, ".", "%1@@@")
		texttable=string.split(textcut, "@@@")
		for i = 1,inum do
			ival=i
			interval=(degrads*(start-(deg*(i-1))))+var1
			interval2=degrads*(start-(deg*(i-1)))
			txs=0+radi*(math.sin(interval))
			tys=0-radi*(math.cos(interval))
			cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
			cairo_set_font_size (cr, fsize);
			cairo_set_source_rgba (cr, tred, tgreen, tblue, talpha);
			cairo_move_to (cr, txs+horiz, tys+verti);
			cairo_rotate (cr, interval2+(180*math.pi/180))
			cairo_show_text (cr, (texttable[i]))
			cairo_rotate (cr, -interval2-(180*math.pi/180))
		end
	end

	function conky_draw_text()

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



--circlewriting variable
cpu=tonumber(conky_parse('${cpu}'))
--text must be in quotes
text=("CPU " .. (addzero100(cpu)) .. "%") 
--font name must be in quotes
font="PT Sans"
fontsize=11
radius=82
positionx=255
positiony=215
colorred=1
colorgreen=0.7
colorblue=0
coloralpha=1
--to set start and finish values for circlewriting, if the text will cross 0 degrees then you must calculate for 360+finish degrees
--eg if you want to go from 270 to 90, then you will input 270 to 450.  Finish has to be greater than start.
start=280
finish=350
letterposition=0
circlewriting(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)

--circlewritingdown variables
mem=tonumber(conky_parse('${memperc}'))
--text must be in quotes
text=("MEMORY " .. (addzero100(mem)) .. "%")
--font name must be in quotes
font="PT Sans"
fontsize=11
radius=82
positionx=255
positiony=215
colorred=1
colorgreen=0.7
colorblue=0
coloralpha=1
--to set start and finish values for circlewritingdown, if the text will cross 0 degrees then you must calculate for 0-finish degrees
--eg if you want to go from 90 to 270, then you will input 90 to -90.  Start has to be greater than finish
start=10
finish=80
letterposition=0
circlewriting(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)

--circlewritingdown variable
hdd=tonumber(conky_parse('${fs_used_perc /}'))
--text must be in quotes
text=("FILESYS " .. (addzero100(hdd)) .. "%") 
--font name must be in quotes
font="PT Sans"
fontsize=11
radius=90
positionx=255
positiony=215
colorred=1
colorgreen=0.7
colorblue=0
coloralpha=1
--to set start and finish values for circlewritingdown, if the text will cross 0 degrees then you must calculate for 0-finish degrees
--eg if you want to go from 90 to 270, then you will input 90 to -90.  Start has to be greater than finish
start=260
finish=190
letterposition=0.06
circlewritingdown(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)

--circlewriting variables
swap=tonumber(conky_parse('${swapperc}'))
--text must be in quotes
text=("SWAP " .. (addzero100(swap)) .. "% ") 
--font name must be in quotes
font="PT Sans"
fontsize=11
radius=90
positionx=255
positiony=215
colorred=1
colorgreen=0.7
colorblue=0
coloralpha=1
--to set start and finish values for circlewriting, if the text will cross 0 degrees then you must calculate for 360+finish degrees
--eg if you want to go from 270 to 90, then you will input 270 to 450.  Finish has to be greater than start.
start=170
finish=100
letterposition=0
circlewritingdown(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)


		end
	end
--[[ END TEXT 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)
     background(cr)
    cairo_destroy(cr)
-- -----------------------------------------------------------------------------------
--[[ Вывод часов ]]
  
	cr = cairo_create(cs)
	clock(cr, 180, 140, 150, 0xffffff, 1, 0x606070, 1)
	cairo_destroy(cr)
-- ---------------------------------------------------------------------------------

	cr = cairo_create(cs)
	calendar()
	cairo_destroy(cr)


-- -------------------------------------------------------------------
	cr = cairo_create(cs)
	conky_draw_text()
	cairo_destroy(cr)

end

appreciate any feedback on this
thanks

Offline

#24 2015-11-08 19:16:42

hhh
Gaucho
From: High in the Custerdome
Registered: 2015-09-17
Posts: 16,032
Website

Re: Conky - Calendars / Clocks / Time

^Wow. I have almost zero interest in conky, but that is a great looking calendar/clock. I'll look into this.


No, he can't sleep on the floor. What do you think I'm yelling for?!!!

Offline

#25 2015-11-08 19:18:05

ceeslans
Member
Registered: 2015-09-30
Posts: 195

Re: Conky - Calendars / Clocks / Time

and forgot one more quirk:
reading complaint in terminal that:

Conky: llua_do_call: function conky_widgets execution failed: /home/cees/.conky/calendar3/calendar3.lua:762: attempt to compare nil with number
Conky: llua_do_call: function conky_widgets execution failed: /home/cees/.conky/calendar3/calendar3.lua:762: attempt to compare nil with number

and for the life of me, can't find what's wrong in line 762
...

Offline

#26 2015-11-08 19:30:47

hhh
Gaucho
From: High in the Custerdome
Registered: 2015-09-17
Posts: 16,032
Website

Re: Conky - Calendars / Clocks / Time

I'm sorry, what packages exactly are required to run that circular clock?


No, he can't sleep on the floor. What do you think I'm yelling for?!!!

Offline

#27 2015-11-08 19:55:55

ceeslans
Member
Registered: 2015-09-30
Posts: 195

Re: Conky - Calendars / Clocks / Time

hhh wrote:

^Wow. I have almost zero interest in conky, but that is a great looking calendar/clock. I'll look into this.

edit:
issue with the fonts being cut off is solved.
just needed to change the xftfont in conkyrc to a narrower font:

xftfont Source Sans Pro:pixelsize=11

also like it better with complete transparent background:

(line 739+740 in lua script)
-- Set the transparency (alpha) of your background.
  local bg_alpha=0.0

and all looking good now smile
conky_calendar3_1.jpg

still leaves the quirk in lua line 762 ... which only happens upon creation of the widget, so no biggie at all
grtz

Offline

#28 2015-11-08 19:58:17

ceeslans
Member
Registered: 2015-09-30
Posts: 195

Re: Conky - Calendars / Clocks / Time

hhh wrote:

I'm sorry, what packages exactly are required to run that circular clock?

I believe it requires cairo and imlib2 ??

Offline

#29 2015-11-08 20:06:29

hhh
Gaucho
From: High in the Custerdome
Registered: 2015-09-17
Posts: 16,032
Website

Re: Conky - Calendars / Clocks / Time

Yes, it says that in the files, but there is no package named just 'cairo' in jessie, which is why I said 'exactly'
https://packages.debian.org/search?keywords=cairo

Like I said, I've no real interest in this but it would be helpful for others who do. Anyway, glad you got it solved.


No, he can't sleep on the floor. What do you think I'm yelling for?!!!

Offline

#30 2015-11-08 20:33:23

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: Conky - Calendars / Clocks / Time

Probably `libcairo2`


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#31 2015-11-08 21:32:02

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,008

Re: Conky - Calendars / Clocks / Time

What you need is the two files found in post #23
2015_11_08_18_29_56_Scrot11.jpg
libcairo2 if I'm not mistaken is already a part of Bunsen.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#32 2015-11-09 05:18:34

nore
>2⁹
From: squirrels' nest
Registered: 2015-09-29
Posts: 537

Re: Conky - Calendars / Clocks / Time

Sector11 wrote:

I've checked all my 'calendar' scripts I can't find anything here that does what you want.  sad

I suspected that, thanks for checking. I'm sure it's possible to transpose the last line of cal -w with some sed magic, but I'll try to dig for that later.

Offline

#33 2015-11-09 11:48:59

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,008

Re: Conky - Calendars / Clocks / Time

@nore

Check out gcal

-- -- -- -- -- -- -- -- --
${goto 70}${color5}${time %T}
${goto 27}${color}SU MO ${color5}${time %b %Y}${color} FR SA CW
${goto 20}${color1}${execpi 1800 LAR=`date +%-d`; gcal -K | sed '1d' | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color1}/' | sed ':a;N;$!ba;s/\n/\n${goto 20}/g'}${color}
-- -- -- -- -- -- -- -- --

2015_11_09_08_27_23_Scrot11.png
I can't figure out next month though and spacing is a bit different with gcal.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#34 2015-11-10 14:40:49

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,640

Re: Conky - Calendars / Clocks / Time

MOD EDIT:  These conky configs are for Conky v1.10 - based on LUA

Many thanks @iMBeCil and @Sector11!

The calendar really liked. smile
calender.th.jpg
die conkys:
Imbcilconkyrc

conky.config = {
	alignment = 'top_left',
	background = false,
	border_width = 0,
--cpu_avg_samples           5
--default_color             white
--default_color             F38536
	default_color = '#707070',
	default_outline_color = 'white',
	draw_borders = false,
	draw_graph_borders = false,
	draw_outline = false,
	draw_shades = false,
	use_xft = true,
--xftfont                   Terminus:size=10
	font = 'DejaVu Sans Mono:size=9',
	xftalpha = 1,
        gap_x = 5,
	gap_y = 0,
--minimum_size              20 0
	minimum_width = 10, minimum_height = 0,
	maximum_width = 1680,
	net_avg_samples = 2,
	no_buffers = true,
	out_to_console = false,
	own_window = true,
	own_window_class = 'Conky',
	own_window_type = 'override',
	own_window_transparent = true,
--own_window_hints          undecorated,below,sticky,skip_taskbar,skip_pager
	update_interval = 30,
	uppercase = false,
	use_spacer = 'left',
	use_spacer = 'right',
	double_buffer = true,
	short_units = true,
	pad_percents = 0,
--text_buffer_size          512   # default 256

};

conky.text = [[
${color}${exec cal -m `date +%m` -A-2 -B2}
${exec cal -m `date +%m` -A-1 -B1}
${color #93470F}${execp cal | sed s/`echo "\x5f\x08\(.\)\x5f\x08\(.\)"`/'${color #FFA500}\1\2${color #93470F}'/}
${color}${exec cal -m `date +%m` -A1 -B-1}
${exec cal -m `date +%m` -A2 -B-2}
${exec cal -m `date +%m` -A3 -B-3}
${exec cal -m `date +%m` -A4 -B-4}
${exec cal -m `date +%m` -A5 -B-5} 
]];

s11_12_month_cal.conky

conky.config = {
-- by El Conkystador - Sector11
-- conky -q -c ~/S11/s11_12_month_cal.conky &
-- pkill -xf "conky -q -c /home/unklar/S11/s11_12_month_cal.conky" &
-- Original by CrunchBang user: iMBeCil
-- http://crunchbang.org/forums/viewtopic.php?pid=368623#p368623

--##  Begin Window Settings  ##################################################
	own_window = true,
	own_window_type = 'override',
	own_window_transparent = false,--yes
	own_window_hints = 'undecorated,below,skip_taskbar,skip_pager',
	own_window_colour = '#707070',
	own_window_class = 'Conky',
--own_window_title = '12 Months',

-- Use the Xdbe extension? (eliminates flicker)
-- It is highly recommended to use own window with this one
-- so double buffer won't be so big.
	double_buffer = true,

--## ARGB can be used for real transparency
--## NOTE that a composite manager is required for real transparency.
--## This option will not work as desired (in most cases) in conjunction with
--## own_window_type normal -  Options: yes or no
--own_window_argb_visual = true,

--## When ARGB visuals are enabled, this use this to modify the alpha value
--## Use: own_window_type normal
--## Use: own_window_transparent no
--## Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
--own_window_argb_value = 200,

	minimum_width = 10, minimum_height = 0,-- w|h
	maximum_width = 1680,

	gap_x = 250,-- l|r
	gap_y = 5,-- u|d

	alignment = 'top_left',
--###################################################  End Window Settings  ###
--##  Font Settings  ##########################################################
-- Use Xft (anti-aliased font and stuff)
	use_xft = true,
	font = 'DejaVu Sans Mono:size=7',
-- Alpha of Xft font. Must be a value at or between 1 and 0 ###
	xftalpha = 1.0,

-- Force UTF8? requires XFT ###
	override_utf8_locale = true,

	uppercase = false,
--#####################################################  End Font Settings  ###
--##  Color Settings  #########################################################
	draw_shades = true,--#yes
	default_shade_color = '#000000',
	draw_outline = false,
	default_outline_color = '#000000',

	default_color = '#778899',--LightSlateGray
	color0 = '#8FBC8F',--DarkSeaGreen
	color1 = '#778899',--LightSlateGray
	color2 = '#F5F5DC',--Beige
	color3 = '#87CEFA',--LightSkyBlue
	color4 = '#48D1CC',--MediumTurquoise
	color5 = '#FFDEAD',--NavajoWhite
	color6 = '#00BFFF',--DeepSkyBlue
	color7 = '#B0E0E6',--PowderBlue
	color8 = '#FFD700',--Gold
	color9 = '#DC143C',--Crimson
--####################################################  End Color Settings  ###
--##  Borders Section  ########################################################
	draw_borders = false,
-- Stippled borders?
	stippled_borders = 0,
-- border margins
	border_inner_margin = 05,
	border_outer_margin = 0,
-- border width
	border_width = 0,
-- graph borders
	draw_graph_borders = true,--no
--default_graph_size 15 40
--####################################################  End Borders Secton  ###
--##  Miscellaneous Section  ##################################################
-- Boolean value, if true, Conky will be forked to background when started.
	background = true,

-- Adds spaces around certain objects to stop them from moving other things
-- around, this only helps if you are using a mono font
-- Options: right, left or none
	use_spacer = 'none',

-- Subtract (file system) buffers from used memory?
	no_buffers = true,

--#############################################  End Miscellaneous Section  ###

	update_interval = 1,
};

conky.text = [[
${if_match "${time %b}" == "Jan"}${goto 15}SU MO ${color5}${time %b %Y}${color} FR SA
${goto 15}${color3}${execpi 86400 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 15}/g'}${color}${else}${goto 10}SU MO ${color5}Jan ${time %Y}${color} FR SA
${goto 10}${color3}${execpi 86400 ncal -bh -m1 | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${endif}
${alignc}${membar 0,50}
${if_match "${time %b}" == "Feb"}${goto 10}SU MO ${color5}${time %b %Y}${color} FR SA
${goto 10}${color3}${execpi 86400 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${else}${goto 10}SU MO ${color5}Feb ${time %Y}${color} FR SA
${goto 10}${color3}${execpi 86400 ncal -bh -m2 | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${endif}
${alignc}${membar 0,50}
${if_match "${time %b}" == "Mar"}${goto 10}SU MO ${color5}${time %b %Y}${color} FR SA
${goto 10}${color3}${execpi 86400 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${else}${goto 10}SU MO ${color5}Mar ${time %Y}${color} FR SA
${goto 10}${color3}${execpi 86400 ncal -bh -m3 | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${endif}
${alignc}${membar 0,50}
${if_match "${time %b}" == "Apr"}${goto 10}SU MO ${color5}${time %b %Y}${color} FR SA
${goto 10}${color3}${execpi 86400 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${else}${goto 10}SU MO ${color5}Apr ${time %Y}${color} FR SA
${goto 10}${color3}${execpi 86400 ncal -bh -m4 | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${endif}
${alignc}${membar 0,50}
${if_match "${time %b}" == "May"}${goto 10}SU MO ${color5}${time %b %Y}${color} FR SA
${goto 10}${color3}${execpi 86400 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${else}${goto 10}SU MO ${color5}May ${time %Y}${color} FR SA
${goto 10}${color3}${execpi 86400 ncal -bh -m5 | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${endif}
${alignc}${membar 0,50}
${if_match "${time %b}" == "Jun"}${goto 10}SU MO ${color5}${time %b %Y}${color} FR SA
${goto 10}${color3}${execpi 86400 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${else}${goto 10}SU MO ${color5}Jun ${time %Y}${color} FR SA
${goto 10}${color3}${execpi 86400 ncal -bh -m6 | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${endif}
${alignc}${membar 0,50}
${if_match "${time %b}" == "Jul"}${goto 10}SU MO ${color5}${time %b %Y}${color} FR SA
${goto 10}${color3}${execpi 86400 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${else}${goto 10}SU MO ${color5}Jul ${time %Y}${color} FR SA
${goto 10}${color3}${execpi 86400 ncal -bh -m7 | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${endif}
${alignc}${membar 0,50}
${if_match "${time %b}" == "Aug"}${goto 10}SU MO ${color5}${time %b %Y}${color} FR SA
${goto 10}${color3}${execpi 86400 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${else}${goto 10}SU MO ${color5}Aug ${time %Y}${color} FR SA
${goto 10}${color3}${execpi 86400 ncal -bh -m8 | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${endif}
${alignc}${membar 0,50}
${if_match "${time %b}" == "Sep"}${goto 10}SU MO ${color5}${time %b %Y}${color} FR SA
${goto 10}${color3}${execpi 86400 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${else}${goto 10}SU MO ${color5}Sep ${time %Y}${color} FR SA
${goto 10}${color3}${execpi 86400 ncal -bh -m9 | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${endif}
${alignc}${membar 0,50}
${if_match "${time %b}" == "Oct"}${goto 10}SU MO ${color5}${time %b %Y}${color} FR SA
${goto 10}${color3}${execpi 86400 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${else}${goto 10}SU MO ${color5}Oct ${time %Y}${color} FR SA
${goto 10}${color3}${execpi 86400 ncal -bh -m10 | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${endif}
${alignc}${membar 0,50}
${if_match "${time %b}" == "Nov"}${goto 10}SU MO ${color5}${time %b %Y}${color} FR SA
${goto 10}${color3}${execpi 86400 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${else}${goto 10}SU MO ${color5}Nov ${time %Y}${color} FR SA
${goto 10}${color3}${execpi 86400 ncal -bh -m11 | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${endif}
${alignc}${membar 0,50}
${if_match "${time %b}" == "Dec"}${goto 10}SU MO ${color5}${time %b %Y}${color} FR SA
${goto 10}${color3}${execpi 86400 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${else}${goto 10}SU MO ${color5}Dec ${time %Y}${color} FR SA
${goto 10}${color3}${execpi 86400 ncal -bh -m12 | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color3}/' | sed ':a;N;$!ba;s/\n/\n${goto 10}/g'}${color}${endif}
${alignc}${membar 0,50}]];

Last edited by unklar (2016-06-07 20:00:33)

Offline

#35 2015-11-10 15:53:15

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,008

Re: Conky - Calendars / Clocks / Time

@ unklar

WUNDERBAR!

EDIT:  One OOPS!  It is not mine, as you show in the 12 Month calendar: iMBeCil

Original by CrunchBang user: iMBeCil

Credit where credit due.

Last edited by Sector11 (2015-11-10 20:14:17)


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#36 2015-11-14 06:15:46

nore
>2⁹
From: squirrels' nest
Registered: 2015-09-29
Posts: 537

Re: Conky - Calendars / Clocks / Time

Sector11 wrote:

Check out gcal

I found a script that takes a step towards solution:
http://unix.stackexchange.com/questions … cal-or-cal
See last post. At first it looks all right, but the week numbers it displays are off by one. I'll settle down without weeks for now, as long as current week is easy to display.

I tried gcal too, it's exhaustive but it is not going stay in my toolbox.

Offline

#37 2015-11-14 16:06:29

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,008

Re: Conky - Calendars / Clocks / Time

@ nore

«« Conky v1.9 »»

I installed and removed various "calendar" programs over the years.  n/cal is the best IMHO.

At that link you provided there is a line that caught my attention - and with a bit of tweaking:

 14 Nov 15 | 10:39:16 ~
    $ ncal -w | tail -1 | awk '{print $1" "$2" "$3" "$4" "$5" "$6}'
44 45 46 47 48 
 
 14 Nov 15 | 10:39:24 ~
    $ ncal -w | tail -1 | awk '{print $1"\n"$2"\n"$3"\n"$4"\n"$5"\n"$6}'
44
45
46
47
48

 
 14 Nov 15 | 10:40:06 ~
    $ ncal -w | tail -1 | awk '{print "  "$1"\n  "$2"\n  "$3"\n  "$4"\n  "$5"\n  "$6}'
  44
  45
  46
  47
  48

In a conky:
2015_11_14_12_53_09_Scrot11.jpg

${alignc}--== ${time %b %d %Y} ==--
Sun: Week N° ${pre_exec ncal -w | tail -1 | awk '{print $1}'}
Sun: Week N° ${pre_exec ncal -S -w | tail -1 | awk '{print $1}'}
Mon: Week N° ${pre_exec ncal -M -w | tail -1 | awk '{print $1}'}

Sun: ${pre_exec ncal -w | tail -1 | awk '{print $1" "$2" "$3" "$4" "$5" "$6}'}
Sun: ${pre_exec ncal -S -w | tail -1 | awk '{print $1" "$2" "$3" "$4" "$5" "$6}'}
Mon: ${pre_exec ncal -M -w | tail -1 | awk '{print $1" "$2" "$3" "$4" "$5" "$6}'}

${pre_exec ncal -w | tail -1 | awk '{print $1"\n"$2"\n"$3"\n"$4"\n"$5"\n"$6}'}

${pre_exec ncal -w | tail -1 | awk '{print "  "$1"\n  "$2"\n  "$3"\n  "$4"\n  "$5"\n  "$6}'}

And an UGLY (for the code) fix that looks OK:
2015_11_14_13_04_26_Scrot11.jpg««--»» Nov2015.png

TEXT
${alignc}${color0}${time %X}
${alignc}${color}SU MO ${color0}${time %b %Y}${color} FR SA
${goto 37}${color1}${execpi 1800 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color0}&${color1}/' | sed ':a;N;$!ba;s/\n/\n${goto 37}/g'}${color}${font}

${alignc}${color0}${time %X}
${alignc}${color}MO TU ${color0}${time %b %Y}${color} SA SU
${goto 37}${color1}${execpi 1800 LAR=`date +%-d`; ncal -bhM | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color0}&${color1}/' | sed ':a;N;$!ba;s/\n/\n${goto 37}/g'}${color}${font}

${alignc}${color5}${time %T}
${alignc}${time %b %Y}${color}
${alignc}${color}CW ${if_match ${time %w}==0}${color5}Su${color1} Mo Tu We Th Fr Sa${else}\
${if_match ${time %w}==1}${color1}Su ${color5}Mo${color1} Tu We Th Fi Sa${else}\
${if_match ${time %w}==2}${color1}Su Mo ${color5}Tu${color1} We Th Fr Sa${else}\
${if_match ${time %w}==3}${color1}Su Mo Tu ${color5}We${color1} Th Fr Sa${else}\
${if_match ${time %w}==4}${color1}Su Mo Tu We ${color5}Th${color1} Fr Sa${else}\
${if_match ${time %w}==5}${color1}Su Mo Tu We Th ${color5}Fr${color1} Sa${else}\
${color1}Su Mo Tu We Th Fr ${color5}Sa${color}\
${endif}${endif}${endif}${endif}${endif}${endif}
${goto 48}${color1}${execpi 1800 LAR=`date +%-d`; ncal -bh | sed '2d' | sed -e '1d' -e 's/\<'$LAR'\>/${color5}&${color1}/' | sed ':a;N;$!ba;s/\n/\n${goto 48}/g'}${color}
${voffset -83}${pre_exec ncal -w | tail -1 | awk '{print "   "$1"\n   "$2"\n   "$3"\n   "$4"\n   "$5"\n   "$6}'}

${color}${alignc}S Y S T E M    I N F O

At least it works!
Depending on your font and size - fiddling with the spacing may be required.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#38 2015-11-14 18:34:25

nore
>2⁹
From: squirrels' nest
Registered: 2015-09-29
Posts: 537

Re: Conky - Calendars / Clocks / Time

It's alive! [Takes a few charleston steps, then bows to the master]
Screenshot_14_11_2015_20_25_05.jpg

TEXT
${font Cuprum: size=36}${color0}${time %H}${voffset 10}${font Cuprum: size=28}${color1}${time %M}${font Cuprum: size=12}${color1}${voffset -40}
${alignr}${time %A}
${alignr}${time %d.%m.%Y}
${alignr}vko ${time %V}${color1}${font}${voffset 20}

${color1}${goto 70}${execpi 1800 LAR=`date +%-d`; ncal -wbhM| sed -e 's/\<'$LAR'\>/${color2}&${color1}/' | sed ':a;N;$!ba;s/\n/\n${goto 70}/g'}${color0}
${voffset -113}${pre_exec ncal -w | tail -1 | awk '{print "   "$1"\n   "$2"\n   "$3"\n   "$4"\n   "$5"\n   "$6}'}

${color1}${goto 70}${execpi 900 ncal -bh -m `date +%m` -A1 -B-1 | sed ':a;N;$!ba;s/\n/\n${goto 70}/g'}${color}${font}${color0}
${voffset -113}${pre_exec ncal -w -A1 -B-1| tail -1 | awk '{print "   "$1"\n   "$2"\n   "$3"\n   "$4"\n   "$5"\n   "$6}'}

Whole conky

Last edited by nore (2015-11-14 19:42:14)

Offline

#39 2015-11-14 19:28:54

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,008

Re: Conky - Calendars / Clocks / Time

^ Looks good nore.  smile
Glad to have helped.

nore wrote:

It's alive! [Takes a few charleston steps, then bows to the master]

Saw that in the "email" and had a vision of a lumberjack putting his axe into the chopping block and doing the Charleston among the chopped wood.**

You did talk about axes and chopping wood once at #! didn't you?  Or am I going mad?

Also: It never occurred to me to use "time %V" - or "%U or %W" for week number ...  good catch!

** "It's alive!" is much more entertaining than "It works!" wink

Last edited by Sector11 (2015-11-14 19:32:10)


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#40 2015-11-15 07:24:08

nore
>2⁹
From: squirrels' nest
Registered: 2015-09-29
Posts: 537

Re: Conky - Calendars / Clocks / Time

I've done my chopping, now I can leave yet another (new!) axe behind the dresser and sit in my rocking chair by the fire playing with conky.
The calendar leaps over the new year without stumbling:
Screenshot_15_11_2015_08_45_57.jpg
Three months

Offline

Board footer

Powered by FluxBB