Remind Widget

This is my Remind widget it's mainly based on the gmail widget from Gigamo's config.

So first off all we create a bashscript named .todo.sh in your home dir

.todo.sh: #!/bin/bash #   REMIND=`remind -q ~/.reminders | wc -l` echo $[($REMIND / 2) -1] This script looks up for for reminders of today in your .reminders and outputs the number of them.

Now we need to create a widget:

remindwidget = widget({ type = "textbox", name = "remindwidget", align = "right" }) remindwidget:buttons({ button({ }, 1, function wicked.update(remindwidget) end) }) function readRemind(format) local f = io.open("/tmp/remind-temp") if f == nil then return {"n/a"} end local n = f:read if n == nil or f == " " or f == "" then f:close return {"n/a"} end return {n} end wicked.register(remindwidget, readRemind, function (widget, args)       local reminds = args[1]        if reminds ~= "n/a" and tonumber(reminds) > 0 then            return spacer..setFg(beautiful.fg_focus, "Rems:")..spacer..setBgFg(beautiful.bg_focus, beautiful.fg_focus, tostring(reminds))..spacer        else            return spacer..setFg(beautiful.fg_focus, "Rems:")..spacer..tostring(reminds)..spacer        end    end, 120)

This Widget looks every 2 minutes in /tmp/remind-temp for some new reminders.

Now add this Widget to your Statusbar: statusbar[s].widgets = ({       ....        remindwidget,        ...    })

In the next step we create a functions that executes our little bash scripts an writes the output into /tmp/remind-temp:

function hookAlmostTwoMinutes os.execute(os.getenv("HOME").."/.todo.sh > /tmp/remind-temp &") end

and a hook to execute it nearly every two minutes: awful.hooks.timer.register(115, hookAlmostTwoMinutes)