Hi again,

now I enhanced a bit of my code and made it much simpler.  You also
don't need emacsclient anymore.

This is the emacs side:

--8<---------------cut here---------------start------------->8---
;; export the current agenda to /tmp/org-agenda.txt
(defun th-org-update-agenda-file (&optional force)
  (save-excursion
    (save-window-excursion
      (let ((file "/tmp/org-agenda.txt"))
        (org-agenda-list)
        (org-write-agenda file)))))

;; do it once at startup
(th-org-update-agenda-file t)

;; do it whenever I change and save an org file
(defun th-org-mode-init ()
  (add-hook 'after-save-hook 'th-org-update-agenda-file t t))
(add-hook 'org-mode-hook 'th-org-mode-init)
--8<---------------cut here---------------end--------------->8---

And that's the awesome side:

--8<---------------cut here---------------start------------->8---
org_agenda_pupup = nil

function show_org_agenda ()
   local fd = io.open("/tmp/org-agenda.txt", "r")
   if not fd then
      return
   end
   local text = fd:read("*a")
   fd:close()
   org_agenda_pupup = naughty.notify(
      { title    = "Org Agenda for this week:", 
        text     = text,
        timeout  = 999999999,
        width    = 600,
        position = "bottom_right" })
end

function dispose_org_agenda ()
   if org_agenda_pupup ~= nil then
      naughty.destroy(org_agenda_pupup)
      org_agenda_pupup = nil
   end
end

mydatebox = widget({ type = "textbox", align = "right" }) -- shows the date
mydatebox.mouse_enter = show_org_agenda
mydatebox.mouse_leave = dispose_org_agenda

-- the mydatebox is added to a wibox and every 5 seconds a hook fills it
-- with the current date/time...
--8<---------------cut here---------------end--------------->8---

That's all.  Simple, isn't it?  Some coloring may be nice, but shouldn't
be too hard to be done.

Bye,
Tassilo


-- 
To unsubscribe, send mail to [email protected].

Reply via email to