Calendar popup

Wise fellows,

I’m reinventing the wheel again as there are thousands of calendars out there prettier than this one. Anyway I’d appreciate your comments, suggestions, improvements on this script.

I launch it from 2 buttons (‘date’ and ‘hour’ near the ‘power’ button) wich you can see here.

To run this calendar you need Perl and Calendar::Simple module (from CPAN).

########## SCRIPTS ######
calendario.pl
Calendar_popup

Wow this is really cool. I have been trying to write something like this for a week now but i could never get everything lined up right. Thanks this is great.

VoiDeR

To line up the days I had to use a fixed-width font: Monospace (and some tricks on Perl too :slight_smile: )

I forgot to mention but I think it is easy to translate months and weekdays names: just edit the Perl file.

Already modified they day and months. I had to dig through the perl file cause i just had to figure out how you got it all to line up and stumbled apon that.

VoiDeR

What perl modules do i have to emerge ???

Mnto bom trabalho man, e bom ver ppl tuga por aki !!!

I dont think its in portage but heres a link to the source.

http://search.cpan.org/dist/HTML-Calendar-Simple/Simple.pm

thanks voider, where do I put it?
or do I need to compile it somhow? I’m not familiar with perl :confused:

Johan

http://search.cpan.org/dist/Calendar-Simple/ Heres a link to the one i used. There are instructions in the tarball but pretty much all you have to do is

perl Makefile.PL make make test make install

thanks, that worked. At first, I only had Simple.pm…

Johan

Glad i could help.

here’s an english version of calendario.pl

#!/usr/bin/perl -Tw
#==========================================================================
#
#         FILE:  calendario.pl
#
#        USAGE:  ./calendario.pl 
#
#  DESCRIPTION:  A small calendar for Fvwm
#
#       AUTHOR:  Miguel Santinho (), <msantinho@simplicidade.com>
#      COMPANY:  Simplicidade.com
#      VERSION:  1.0
#      CREATED:  03-09-2005 15:37:08 WEST
#     REVISION:  ---
#==========================================================================
#==========================================================================
#  This program is free software; you can redistribute it and/or modify 
#  it under the terms of the GNU General Public License as published by 
#  the Free Software Foundation; either version 2 of the License, or    
#  (at your option) any later version.                                  
#==========================================================================

use strict;
use Calendar::Simple;

my $months = {
	1  => 'January',
	2  => 'February',
	3  => 'March',
	4  => 'April',
	5  => 'May',
	6  => 'June',
	7  => 'July',
	8  => 'Agust',
	9  => 'September',
	10 => 'October',
	11 => 'November',
	12 => 'December',
};

my $mon = ((localtime)[4] + 1);
my $yr = ((localtime)[5] + 1900);

my @month = calendar($mon, $yr, 1);

# TITULO
print $months->{$mon}, " ", $yr, "\n";

# DIAS SEMANA
print "MON TUE WEN THU FRI SAT SUN\n";

foreach my $line (@month) {

	foreach my $dia (@$line) {

		my $dia_out = $dia;

		# MARCAR DIA ACTUAL
		$dia_out = "*" . $dia if $dia
		&& 
		$dia == (localtime)[3]
		&& 
		$mon == ((localtime)[4] + 1);

		if ( $dia_out ) {

			if ( length $dia_out == 1 )
			{
				print "  " . $dia_out . " ";
				
			} elsif ( length $dia_out == 2 )
			{
				print " " . $dia_out . " ";
				
			} elsif ( length $dia_out == 3 )
			{
				print $dia_out . " ";
			}

		} else {
			print "    ";
		}
	}
	print "\n";
}

Merci,