i have a funtion that returns a pango highlighted calendar:
function pangocalendar()
daycolor = '#E89393'
a = io.popen("cal")
headline = a:read()--:match('%s*(.*)%s*') --Name rausmatchen mit regex
week = a:read()
cal = a:read('*all'):sub(1,-2)
day = os.date('*t')['day']
headline = '<span font="DejaVu Sans Mono Book"
weight="bold">'..headline..'</span>'
week = '<span font="DejaVu Sans Mono Book"
weight="bold">'..week..'</span>'
cal = '<span font="DejaVu Sans Mono Book">'..cal..'</span>'
cal = cal:gsub('[^%d]'..day..'[ \n]','<span weight="bold"
color="'..daycolor..'">%0</span>')
return headline..'\n'..week..'\n'..cal
end
adjust colors, fonts, etc and you should be good to go.
2011/11/8 Uli Schlachter <[email protected]>:
> Hi,
>
> On 08.11.2011 15:33, Matija Žeželj wrote:
> [..]
>> function add_calendar(inc_offset)
>> local save_offset = offset
>> remove_calendar()
>> offset = save_offset + inc_offset
>> local datespec = os.date("*t")
>> datespec = datespec.year * 12 + datespec.month - 1 + offset
>> datespec = (datespec % 12 + 1) .. " " .. math.floor(datespec / 12)
>> local cal = awful.util.pread("cal " .. datespec)
>
> You could use "cal -h" to turn off highlighting.
>
>> cal = string.gsub(cal, "^%s*(.-)%s*$", "%1")
>> calendar = naughty.notify({
>> text = string.format('<span font_desc="%s">%s</span>',
>> "Profont", os.date("%a, %d. %B %Y") .. "\n" .. cal),
>> timeout = 0, hover_timeout = 0.5,
>> width = 165,
>> })
>> end
> [...]
>
> The above is the quick fix. The long fix would be lots of magic.
>
> cal uses shell escape sequences to highlight the current date. Those only work
> in the shell. So the "real" fix would be to figure out how to match those
> shell
> escapes and replace them with pango markup. And no, don't ask me about
> details,
> I don't know.
>
> Uli.
>
> --
> - He made himself, me nothing, you nothing out of the dust
> - Er machte sich mir nichts, dir nichts aus dem Staub
>
> --
> To unsubscribe, send mail to [email protected].
>
--
To unsubscribe, send mail to [email protected].