--- /dev/null
+package Display::Plugins::Clock;
+
+use Clutter;
+use POSIX qw/strftime/;
+
+sub new {
+ my ($class,$stage) = @_;
+
+ my $self = {
+ 'stage' => $stage,
+ };
+
+ bless ($self, $class);
+ $self->init();
+ return $self;
+}
+
+sub display {
+ my $self = shift;
+
+ $self->{'clock'}->set_text(strftime("%H:%M %d/%m/%Y", localtime(time)));
+
+ Glib::Timeout->add_seconds(60 - strftime(%s, localtime()), $self->can('display'), $self);
+
+ return 0;
+}
+
+sub init {
+ my $self = shift;
+
+ $self->{'clock'} = Clutter::Label->new('Sans 20', strftime("%H:%M %d/%m/%Y", localtime(time)));
+ $self->{'clock'}->set_anchor_point($self->{'clock'}->get_width(), 1);
+ $self->{'clock'}->set_position($self->{'stage'}->get_width() - 20, 15);
+ $self->{'clock'}->set_color(Clutter::Color->parse('White'));
+
+ $self->{'bg'} = Clutter::Rectangle->new(Clutter::Color->parse('Black'));
+ $self->{'bg'}->set_width($self->{'clock'}->get_width() + 20);
+ $self->{'bg'}->set_height($self->{'clock'}->get_height() + 10);
+ $self->{'bg'}->set_anchor_point($self->{'bg'}->get_width(), 1);
+ $self->{'bg'}->set_position($self->{'stage'}->get_width() - 10, 10);
+ $self->{'bg'}->set_opacity(100);
+
+ $self->{'stage'}->add($self->{'bg'});
+ $self->{'stage'}->add($self->{'clock'});
+
+ Glib::Timeout->add_seconds(60 - strftime(%s, localtime()), $self->can('display'), $self);
+}
+
+1;