you can have numbers, numbers and days or even just days and you can set different fonts, sizes and colors for numbers and days. there are a number of settings to adjust at the top of the lua script.
--vertical cal by mrpeachy dec 8th 2011
require 'cairo'
function conky_cal()
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
cr = cairo_create(cs)
local updates=tonumber(conky_parse('${updates}'))
if updates>5 then
--#########################################################################################################
--Settings--Settings--Settings--Settings--Settings--Settings--Settings--Settings--Settings--Settings
--fonts and font sizes
local font_txt="Mono"
local font_size_txt=10
local font_num="Sans"
local font_size_num=20
--colors, colors and alpha set as number between 0 and 1
--[[note on colors
when you see colors represented for example in gimp they are given
as a value out of 255. In lua/cairo 255 would be 1. You can easily use
calculations in lua if you have your rgba numbers out of 255
as in the first setting below:
for alpha, the 4th number, 0=full transparent, 1=full opaque
]]
local rgba_num_bg={100/255,200/255,50/255,1}--base color for numbers
local rgba_num_ind={1,0,0,1}--indicator color for numbers
local rgba_name_bg={1,1,0,1}--base color for names
local rgba_name_ind={1,0,0,1}--indicator color for names
--day name type
local num_name=2--set 1 for numbers only, 2 for numbers and day names, 3 for day names only
local long_short=2--1 for long (Tuesday), 2 for short (Tue)
local lower_normal_upper=3--1 for all lower (tuesday/tue), 2 for normal (Tuesday/Tue), 3 for caps (TUESDAY/TUE)
--position
local toply=20--will apply to numbers and names
local top_left_x_number=200--adjust along with gaph to make names first
local top_left_x_name=230
local gapv=3--gap between lines
--gaph=5--gap between numbes and day names, make negative and adjust top_left_x to have day names first
local v_number=0--use to move numbers up and down independantly of names
local v_name=-5--use to move day names up and down independantly of numbers
local pad_zero=1--1 for padding zeros 2 for no padding
--############################################################
--calculations
local year4num=os.date("%Y")
local t1 = os.time( { year=year4num,month=03,day=01,hour=00,min=0,sec=0} );
local t2 = os.time( { year=year4num,month=02,day=01,hour=00,min=0,sec=0} );
local febdaynum=tonumber((os.difftime(t1,t2))/(24*60*60))
local monthdays={31,febdaynum,31,30,31,30,31,31,30,31,30,31}
--calculate what day is the first----------
local this_month=tonumber(os.date("%m"))
local todaynum=tonumber(os.date("%d"))
local dayofweek=tonumber(os.date("%w"))
-------------------------------------------
n=todaynum
v=0
while n>0 do
v=v+1
n=n-7
end
calc=(todaynum-((v-1)*7))-1
day1st=((dayofweek-calc) % 7)
-------------------------------------------
local text="MondayTuesdayWednesdayThursdayFridaySaturdaySunday"
cairo_select_font_face (cr, font_txt, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, font_size_txt)
local extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local theightt=extents.height
--calculate height of numbers
local text="1234567890"
cairo_select_font_face (cr, font_num, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, font_size_num)
local extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local theightn=extents.height
if theightt>theightn then
height=theightt
else
height=theightn
end
--set day name types
if long_short==1 then
if lower_normal_upper==1 then
days={"monday","tuesday","wednesday","thursday","friday","saturday","sunday"}
elseif lower_normal_upper==2 then
days={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"}
else
days={"MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY","SUNDAY"}
end
else
if lower_normal_upper==1 then
days={"mon","tue","wed","thu","fri","sat","sun"}
elseif lower_normal_upper==2 then
days={"Mon","Tue","Wed","Thu","Fri","Sat","Sun"}
else
days={"MON","TUE","WED","THU","FRI","SAT","SUN"}
end
end
--print numbers and names
for i=0,monthdays[this_month]-1 do
day=(((i % 7)+day1st) % 7)
if day==0 then day=7 end
if num_name==1 or num_name==2 then--print numbers
if todaynum==i+1 then
cairo_set_source_rgba (cr,rgba_num_ind[1],rgba_num_ind[2],rgba_num_ind[3],rgba_num_ind[4])
else
cairo_set_source_rgba (cr,rgba_num_bg[1],rgba_num_bg[2],rgba_num_bg[3],rgba_num_bg[4])
end
cairo_move_to (cr,top_left_x_number,toply+(height*(i+1))+(gapv*i)+(v_number))
if pad_zero==1 then
if i+1<10 then
num="0"..i+1
else
num=i+1
end
else
num=i+1
end
cairo_select_font_face (cr, font_num, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, font_size_num)
cairo_show_text (cr,num)
cairo_stroke (cr)
end
if num_name==2 or num_name==3 then
--print day names
if todaynum==i+1 then
cairo_set_source_rgba (cr,rgba_name_ind[1],rgba_name_ind[2],rgba_name_ind[3],rgba_name_ind[4])
else
cairo_set_source_rgba (cr,rgba_name_bg[1],rgba_name_bg[2],rgba_name_bg[3],rgba_name_bg[4])
end
cairo_select_font_face (cr, font_txt, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, font_size_txt)
cairo_move_to (cr,top_left_x_name,toply+(height*(i+1))+(gapv*i)+(v_name))
cairo_show_text (cr,days[day])
cairo_stroke (cr)
end
end
--print (dayadj)
--#########################################################################################################
end-- if updates>5
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end-- end main function
the script doesnt output any headers or footers, just numbers and days at the moment
It's hard to find something if you don't know what you're looking for.
I have a blog, it's mostly about conky and lua stuff... go
here.