mirror of
https://github.com/lcpz/awesome-copycats.git
synced 2024-12-23 03:32:30 +00:00
dremora: cool cal perfected
This commit is contained in:
parent
90e11cfd11
commit
89980d9fa8
|
@ -164,6 +164,7 @@ gray = "<span color='#9e9c9a'>"
|
||||||
mytextclock = awful.widget.textclock(white .. "%H:%M" .. coldef)
|
mytextclock = awful.widget.textclock(white .. "%H:%M" .. coldef)
|
||||||
|
|
||||||
-- attached calendar
|
-- attached calendar
|
||||||
|
local tonumber = tonumber
|
||||||
local calendar = nil
|
local calendar = nil
|
||||||
local offset = 0
|
local offset = 0
|
||||||
|
|
||||||
|
@ -178,22 +179,24 @@ function show_calendar(inc_offset, t_out)
|
||||||
remove_calendar()
|
remove_calendar()
|
||||||
local c_text
|
local c_text
|
||||||
|
|
||||||
if inc_offset == 0 or offset ~= 0 then
|
if inc_offset == 0 then
|
||||||
local f = io.popen('/usr/bin/cal | sed -r -e "s/(^| )(`date +\\"%d\\"`)($| )/\\1<b><span foreground=\\"#121212\\" background=\\"#D7D7D7\\">\\2<\\/span><\\/b>\\3/"',"r")
|
local f = io.popen('/usr/bin/cal | sed -r -e "s/(^| )(`date +\\"%d\\"`)($| )/\\1<b><span foreground=\\"#121212\\" background=\\"#D7D7D7\\">\\2<\\/span><\\/b>\\3/"',"r")
|
||||||
c_text = "<tt><span weight='bold' font='Tamsyn 12'>" .. f:read() .. "</span>\n\n<span font='Tamsyn 12'>" .. f:read() .. "\n" .. f:read("*all") .. "</span></tt>"
|
c_text = "<tt><span weight='bold' font='Tamsyn 12'>" .. f:read() .. "</span>\n\n<span font='Tamsyn 12'>" .. f:read() .. "\n" .. f:read("*all") .. "</span></tt>"
|
||||||
f:close()
|
f:close()
|
||||||
offset = 0
|
offset = 0
|
||||||
else
|
else
|
||||||
local month = os.date('%m')
|
local month = tonumber(os.date('%m'))
|
||||||
local year = os.date('%Y')
|
local year = tonumber(os.date('%Y'))
|
||||||
|
|
||||||
offset = offset + inc_offset
|
offset = offset + inc_offset
|
||||||
if month == '12' and inc_offset == 1 then
|
month = month + offset
|
||||||
month = 1
|
|
||||||
year = year + 1
|
if month > 12 then
|
||||||
elseif month == '1' and inc_offset == -1 then
|
|
||||||
month = 12
|
month = 12
|
||||||
year = year - 1
|
offset = 12 - tonumber(os.date('%m'))
|
||||||
else month = month + offset
|
elseif month < 1 then
|
||||||
|
month = 1
|
||||||
|
offset = 1 - tonumber(os.date('%m'))
|
||||||
end
|
end
|
||||||
|
|
||||||
f = io.popen('/usr/bin/cal ' .. month .. ' ' .. year ,"r")
|
f = io.popen('/usr/bin/cal ' .. month .. ' ' .. year ,"r")
|
||||||
|
|
Loading…
Reference in a new issue