Life, thinking, communication, creativity/logistics, reality, integrity, unconscious wisdom, queer politics, activism, bisexuality, polyamory, love, relationships, parenting… and books.
Jennifer's Uncharted Worlds blog.

Remind + Ubuntu + Gmessage

A bit of geekery for a change. I’ve recently been trying out the Remind program, and I thought I’d share some of what I learnt.

I have to say that if you’ve got no need or inclination to run some nice reminder-popup software, you can safely skip this post :-)

Note: I’m running Linux, and if I understand correctly, Remind is also available for Macs but not Windows.

I thought this little adventure was worth a write-up, because I’ve done a couple of things which I didn’t discover already-spelt-out on the web – things which took some trial and error to work out, but were surprisingly straightforward in the end. So maybe this’ll give someone else a shortcut to some nice results with their new toy :-)

Some back-story

I like software that helps me keep track of what I’m doing. I have a diary on a Psion 3mx, which travels with me, and a home-made PHP/MySQL things-to-do list program which runs in a browser window on my PC. And for the last year or two I’ve been using MyChores to send myself emails for date-specific stuff like putting the bins out. But there was a missing ingredient: I wanted something to give me a popup window on the computer at certain days and times.

The proximal motivation for this was when I realised that I’d missed my favourite swimming session through being absorbed in writing something on the computer. Bother!

Before that, I’d already been thinking it would be v cool if at about 8pm on certain days of the week, my computer suggested that I go and put a wash in the washing machine. You see, i.m.o. the greenest/cheapest/best time to run a wash is in the last few hours of cheap overnight electricity. (Or, second choice, the earlier hours of the cheap electricity – but the earlier in the night it runs, the longer the wash is sitting damp in the machine before it gets hung up to dry.) So ideally you want it to start about 4am. And we have an old but good washing machine which has a timer you can set to 4, 8 or 12 hours’ delay. So if you put in a wash at about 8pm or 8.30, you can use the 8 hour timer and it works out just nicely.

Now I could have set alarms for either of those things in my Psion diary. But then the Psion might be in another room and just run its battery down bing-bonging to itself. (In fact I very rarely use it for alarms at all.) Or I might be out somewhere else, in which case I’m not likely to go swimming or put in a wash. And besides, I don’t want “Put a wash in” cluttering up my Psion diary page. No, a popup on my PC screen was what I wanted.

That’s not to say I would always see the popup. I wouldn’t rely on this method for anything which absolutely had to happen at a certain time. The computer might not even be switched on.

But on the whole, that’s probably more a feature than a bug, for the kinds of things I’m using it for – because if I’m at the computer (rather than, say, on the phone, or indeed not even in my house at all), it’s also fairly likely that I can interrupt what I’m doing long enough to do the suggested activity. And if not, of course I can just ignore the suggestion.

I do spend quite a lot of time reading or writing at my lovely quiet PC, though. And, perhaps more important, writing on the computer is my most likely way to lose track of time. If I were doing almost anything else, I’d be quite likely just to remember to go swimming :-)

So I had a look around online and Remind did seem like just the job.

Here’s a nice intro from David F Skoll, the writer of Remind, which gives an overview of the kind of things it can do. (Incidentally, that includes some things I’ve not talked about here at all, because I currently have no plans to use them – e.g. making calendar printouts. Apparently it can even draw moons onto your calendars!)

I’m running Ubuntu Hardy Heron, and it turned out that Synaptic Package Manager had Remind in it, so I didn’t have to do anything tricky to install it. I think I did have to create an empty .reminders file myself (as a text file in the Home directory). That’s the default file for your reminders – but you can have others, as we shall see.

Setting reminders

Using the instruction “remind” at a terminal worked first time. It told me I didn’t have any reminders :-)

There’s a front end called tkremind. I put a couple of things in there to try it out.

Instead of using tkremind, though, I quickly found myself wanting to do things with Remind’s text syntax. Tkremind is pretty, but there seem to be some fairly simple things it can’t do, as well as lots more ingenious power which it doesn’t reveal.

I used gedit to get into the .reminders file. I found the basic syntax pretty sensible and easy to figure out. Here for example is my “put a wash in” reminder:

REM Mon Tue Fri Sat AT 20:00 MSG Good time to put in a wash.

I shan’t give you a detailed run-down of the reminder syntax, because there are plenty of other articles already talking about that aspect. For instance, here’s one, including some Mac tips. Here’s a Remind Cookbook page, full of snippets. And here’s the very comprehensive manual page for Remind, with lots of options and clever bits.

I also put in my favourite swimming sessions, and some day-specific ones like “check current account has enough in it to cover credit card bill”. And just to play with the thing, I added a couple of countdowns to particular dates. (More below on the “countdown” bit.) So far so good!

Making it pop up

Then came the more tricky part. How could I make it do popups?

Remind doesn’t generate the popup windows itself – it calls on another program to make them. So the first question was what program I’d call on to do that.

The Remind FAQ suggested gxmessage, and somewhere else I saw a mention of xmessage.

Xmessage was already installed, so I tried that first. And it worked – but I didn’t like how the windows came out. There seemed to be no way to set the font size, and the default on my system was uncomfortably tiny to read.

(Font size bother seems to have been a recurring theme for me with Hardy Heron – by default it’s been giving me some odd mixes of little and large, clearly not the same settings as Feisty which I had before. Various preference-tinkering was required on other apps to compensate. So I imagine other people might find the xmessage default was perfectly fine for them.)

On the other hand, in gxmessage you can set not only the font size, but the font and background colours. So immediately I was thinking oh, I could have my swimming reminders coming up in blue, and the household ones in dark red, and so on…

Gxmessage turned out to be in Synaptic Package Manager as well, albeit under its pseudonym of gmessage. So, like Remind, it was a matter of a few clicks to install.

What pops up when

Next there was the question of what popups to have when. I didn’t just want all of them blobbing on top of each other in separate windows as soon as the program ran – which is one result you can get ;-)

What I wanted was

  1. today’s non-timed reminders when I logged on, all together in one window. And
  2. the time-specific ones not to pop up then, but only later at their specified times.

I realised that one way to elicit these different behaviours was to have more than one reminder file, and instruct Remind differently when it works with each of them.

(You can use a RUN command in Remind to call another program at a certain time. So that may be another way to do what I’m about to describe – I’m not sure. But I was wary of getting into a tangle with gmessage’s options if I tried it that way.)

I’ll spare you a step by step account of my experiments. Instead I’ll skip ahead to describing what it’s doing now and how it’s doing it.

Multiple reminders in one popup window

To get today’s non-timed messages all into one window which appears at startup, what I did was:

  1. Set up a separate reminder file called “.reminders-today”.
  2. Invoke it like this (initially tested from the command line): remind -q ~/.reminders-today | gxmessage -buttons "OK:1" -default "OK" -center -font "serif 16" -fg "#579" -bg white -wrap -title "Today's reminders" -file -

That instruction takes everything from the .reminders-today file which would have been written to the terminal that day, and pipes it to gmessage instead.

The options before the “pipe” belong to remind, and the options after the “pipe” belong to gmessage.

It’s the “-file -” option which tells gmessage to use incoming input rather than a pre-determined message. You can also see various options I chose from the gmessage manual page, just to get my popups looking how I want them.

-buttons "OK:1" -default "OK" does a nice thing: it means the OK button already “has focus”, so you can just hit the Return key to make the popup go away.

Strictly speaking, Remind’s -q option is redundant here. It tells remind not to queue timed messages, but in fact it’s fundamental to my setup that I haven’t put any timed messages into this file in the first place. Instead they’re in separate ones.

Different colours and different times

Now, what about my time-specific swimming reminders popping up in blue writing, later on in the day? Here’s what I did:

  1. Set up another file, this one called “.reminders-swimming”.
  2. Invoke it like this: remind -a '-kgmessage -buttons "OK:1" -default "OK" -center -font "serif 16" -fg "#46f" -bg white -wrap -title "Swimming" %s &' ~/.reminders-swimming

Note the different shape of the remind instruction. Instead of piping the whole batch of reminders into gmessage in one go (as they would have appeared in the terminal), it uses the -k flag of Remind to send each reminder individually to gmessage. The %s is where Remind hands the text over to gmessage. (If I’d used this command to process the “today” reminders, each reminder would have been a separate popup, regardless of any timing instruction.)

-a belongs to Remind, and tells it not to display the day’s timed reminders when it first boots, only to queue them for their set times.

-fg belongs to gmessage, and sets the foreground colour, i.e. font colour. So yes – I’ve selected a lovely sky-blue font for this batch of popups :-)

Making it run automatically

My next challenge was to launch Remind automatically, rather than by opening a terminal and putting in something at the command line.

I wanted it to launch on startup. Some of the information I’d found had me poking around looking at .xinitrc and other arcane places. But then I discovered that was unnecessary in Ubuntu. Instead, I needed to go to System > Preferences > Sessions. It has an “Add” button whereby you can add something to the Startup Programs list.

The first thing I tried was to put the command line instruction directly into the “Command” field of the “Add” dialogue. But it turned out the startup process didn’t like that.

What worked instead was to enclose it in a shell script, and call the filename of the script.

(In this context, a shell script is a command or series of commands which you might have written to the command line in a terminal window, but put in a text file instead.)

Using a shell script made sense to me anyway, as I wanted to launch Remind several times, and this way, I could have all the several commands batched together in one file.

A possible script:

#!/bin/bash

remind -q ~/.reminders-today | gxmessage -buttons "OK:1" -default "OK" -center -font "serif 16" -fg "#579" -bg white -wrap -title "Today's reminders" -file -

remind -a '-kgmessage -buttons "OK:1" -default "OK" -center -font "serif 16" -fg "#46f" -bg white -wrap -title "Swimming" %s &' ~/.reminders-swimming

remind -a '-kgmessage -buttons "OK:1" -default "OK" -center -font "serif 16" -fg "#a33" -bg white -wrap -title "Household" %s &' ~/.reminders-household

I saved one similar to that as reminders.sh, then put “/home/jennifer/reminders.sh” into the “command” field for adding a startup program. (I can’t remember now if it definitely needed the full path or if I was just being on the safe side.)

Note the two separate calls for “household” and “swimming”, and their different titles and font colours used by gmessage. You can see from this that the way I’m making my popups have different colours is simply by having a separate invocation of Remind to process each file, with a different colour-setting flag for gmessage in each invocation.

Edited to add: Aimee suggested I add a screenshot of one of my popups, so here it is:

Thoughts so far

In one way, this method might seem a bit clunky. There may well have been more elegant ways of doing something similar, which I just don’t know about.

On the other hand, one nice effect of it is to keep the .reminder files nicely uncluttered – and they’re the ones I’m most likely to be altering over time. As it is, I can easily add more swimming reminders or household reminders, or change them, without needing to touch (or even look at) the shell script with the gmessage options. And I find it reasonably intuitive to have reminders batched by theme, so I don’t mind the tiny overhead of potentially needing to open different files when I’m updating them.

If I wanted yet another colour for timed popups – for a different reminder-theme – then I’d just have to make one more file and add one more very similar line to the shell script.

So overall I’m pretty happy with the setup so far, and I think Remind has certainly lived up to its reputation for flexibility.

Thanks and tip of the hat to David Skoll for writing such a cool thing, and likewise to Timothy Musson for gmessage! And thanks to everyone else who’s gone before and written theirs up.

Bonus bit: Weeks and days countdown

I said I wouldn’t repeat the details of how to set up your clever Remind syntax, which has been well documented elsewhere. But here’s one bit which I hadn’t seen elsewhere on the web.

A couple of places gave snippets for doing a countdown to a particular date, either in days or rounded to the nearest week. I decided I wanted a variation on that – a countdown in the format “X weeks Y days”.

Remind has various functions built in, and also lets you set your own using the fset command. (I could have made my snippet a lot shorter, following the example of the existing countdown ones, but I spread it out for clarity of variable-names, so I could see what I was doing.)

Here’s what I came up with:

# weeks/days countdown

# (note integers only, no decimal points, so no need to round the /7)

fset _all_days() trigdate()-today()

fset _whole_weeks() (_all_days()/7)

fset _odd_days() (_all_days()-(_whole_weeks()*7))

fset _weekplural() plural(_whole_weeks())

fset _dayplural() plural(_odd_days())

REM 1 January +30 MSG [_whole_weeks()] week[_weekplural()] [_odd_days()] day[_dayplural()] to New Year's Day

The +30 is the number of days in advance of your “special date” that the reminder will run.

Note that some of the brackets may be redundant, but are there to be “on the safe side”.

Hope some of that proves useful to someone.

Here, have an index…
Remind + Ubuntu + Gmessage
Some back-story
Setting reminders
Making it pop up
What pops up when
Multiple reminders in one popup window
Different colours and different times
Making it run automatically
Thoughts so far
Bonus bit: Weeks and days countdown

Categories: Geekery, Remembering.
Posted on 30 April 2009 at 23:29.
Copyright © Jennifer Moore 2009. All rights reserved.

You can comment below, send feedback to Jennifer, or trackback from your own site.

4 responses to “Remind + Ubuntu + Gmessage”

aimee.mychores.co.uk says:

Wow, that is most excellently impressive! I never knew you had such l33t programm0r skllz!

One thing this post could do with is a screenshot of what a reminder looks like when it pops up. I’ve never come across gmessage before – i have an idea in my head of what it might look like, but it would be cool to see how you’re using it.

Jennifer says:

Oooh, how nice of you to say :-)

::tickled::

Thanks for the screenshot idea – yes good plan! I’ve just done an “edited to add”.

FN/Frederick Noronha says:

Thanks, and just to say I found this useful. I’m using Remind as in this:
http://groups.google.com/group/goajourno/browse_thread/thread/15db861ce5482d73

Eivind says:

There’s a graphical GUI for Remind written in wxPython; wxRemind
http://www.duke.edu/~dgraham/wxRemind/

…yes and a console GUI in ncurses; Wyrd
http://pessimization.com/software/wyrd/

…for those that might find any of those useful…

Write a comment here if you like:

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

RSS2 feed for comments

XHTML tags usable in comments: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>