Browse Source

Add simple calendar in conky

master
Maxime Wack 1 year ago
parent
commit
32046f9e58
2 changed files with 23 additions and 1 deletions
  1. +2
    -0
      .config/bin/calendar
  2. +21
    -1
      .config/conky/conky.lua

+ 2
- 0
.config/bin/calendar View File

@@ -21,3 +21,5 @@ convert \( -density 250 /tmp/agenda_export.ps \
-gravity SouthEast /home/maxx/Projects/reMarkable/remarkableissleeping.png -composite /tmp/agenda_export.png

rsync /tmp/agenda_export.png android@home:RM/agenda_export.png

cal --color=always -n 2 -m > /tmp/cal.txt

+ 21
- 1
.config/conky/conky.lua View File

@@ -91,8 +91,9 @@ if hostname == "home" then
weather(cr, screenWidth / 2 - 11.5*.6*15, screenHeight / 2 - 60)
else
clock(cr, screenWidth - 260, 170)
calendar(cr, screenWidth - 480, 475)
weather(cr, screenWidth - 420, 290)
calendar(cr, screenWidth - 475, 440)
agenda(cr, screenWidth - 480, 620)
end

cairo_destroy(cr)
@@ -105,6 +106,25 @@ function clock(cr, x, y)
end

function calendar(cr, x, y)
size = 18
yt = 0
for line in io.lines("/tmp/cal.txt") do
yt = yt + size
xt = 0
for substr in string.gmatch(line, "[^]+") do
if substr:match("%[7m") then
color = {.45, .65, .9, 1}
else
color = nil
end
substr = substr:gsub("%[.?7m", "")
emboss(cr, x + xt, y + yt, substr, 0, size, nil, color, "Fira Code")
xt = xt + .6*size * utf8.len(substr)
end
end
end

function agenda(cr, x, y)
size = 14
yt = 0
for line in io.lines("/tmp/agenda_export.txt") do


Loading…
Cancel
Save