[Remind-Fans] Reminder Popups with date and time

Mark Lawrence nomad at null.net
Sun Jun 5 18:35:01 EDT 2011


On Sat Jun 04, 2011 at 08:53:56PM +0200, John Niendorf wrote:
> 
> I'm currently using
> [CODE]
> remind ~/.reminders-general | gxmessage -buttons "OK:1" -default "OK"
> -center -font "serif 16" -fg "#231" -bg yellow -wrap -title "Don't Forget'"
> -file -
> [/CODE]
> 
> To generate popups for things I need to remember.
> 
> My reminder format is:
> 
> REM 6 June 2011 +8 % Presentation on Free OS %b
> 
> This works and give me a countdown to how many days I have left.
> 
> My question is:
> 
> Is there a way to also get a countdown to a specific time.  That is instead
> of the popup showing ...in two day's time is it possible to have it display
> ...in two days 6 hours and 30 minutes time for example?

I don't know if there is a way to generate that information from remind
itself, but if you are comfortable with scripting Perl then I could
recommend using Date::Remind::Event[1] and Time::Duration[2] from CPAN
(the Compreshensive Perl Archive Network) as a filter between "remind"
and "gxmessage".

Here is an example that might get you started (warning: completely
untested code):

    #!/usr/bin/perl
    use strict;
    use warnings;
    use Date::Remind::Event;
    use Time::Duration qw/ago/;

    while ( my $line = <> ) {
        chomp $line;
        my $event = Date::Remind::Event->new($line);
        print ago(time - $event->date->epoch) .': '. $event->body ."\n";
    }

If you put the above into remind-filter.pl (as set the appropriate PATH
and executable permission) you could then call it as follows:

    remind -s ~/.reminders-general | remind-filter.pl | gxmessage ...

Ok, I did in fact test it and got the following:

    24 days and 2 hours from now: ** Backup Laptop **

Hope that helps.

Cheers,
Mark.

[1] http://search.cpan.org/~mlawren/Date-Remind-Event-0.04/lib/Date/Remind/Event.pm
[2] http://search.cpan.org/~avif/Time-Duration-1.06/Duration.pm

disclaimer: I am the author of Date::Remind::Event

-- 
Mark Lawrence


More information about the Remind-fans mailing list