use POSIX qw/strftime/;
use base ('Display::Plugin');
+my $delay = 15;
+
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
$self->{'bg'}->set_position(10, $self->{'stage'}->get_height() - 10);
$self->{'status'}->set_anchor_point(1, $self->{'status'}->get_height());
- $self->{'status'}->set_position(15, $self->{'stage'}->get_height() - 20);
+ $self->{'status'}->set_position(20, $self->{'stage'}->get_height() - 20);
if (! $self->{'active'}) {
- $self->{'stage'}->add($self->{'bg'});
- $self->{'stage'}->add($self->{'status'});
+ $self->{'block'}->set_opacity(0);
+ $self->{'stage'}->add($self->{'block'});
+ my $effect = Clutter::EffectTemplate->new_for_duration(1000, 'main::smoothstep_inc');
+ my $timeline = Clutter::Effect->fade($effect, $self->{'block'}, 255);
+ $timeline->start();
- $self->{'active'} = time() + 30;
+ $self->{'active'} = time() + $delay;
}
- Glib::Timeout->add_seconds(30, $self->can('hide_display'), $self);
+ Glib::Timeout->add_seconds($delay, $self->can('hide_display'), $self);
}
return 1;
my $self = shift;
if ($self->{'active'} <= time()) {
- $self->{'stage'}->remove($self->{'status'});
- $self->{'stage'}->remove($self->{'bg'});
+ $self->{'stage'}->remove($self->{'block'});
$self->{'active'} = 0;
}
sub init {
my $self = shift;
- $self->{'status'} = Clutter::Label->new('Sans 20', "Song\nAlbum");
- $self->{'status'}->set_color(Clutter::Color->parse('White'));
+ $self->{'block'} = Clutter::Group->new();
$self->{'bg'} = Clutter::Rectangle->new(Clutter::Color->parse('Black'));
- $self->{'bg'}->set_width($self->{'stage'}->get_width() - 40);
+ $self->{'bg'}->set_width($self->{'stage'}->get_width() - 20);
$self->{'bg'}->set_opacity(100);
+ $self->{'status'} = Clutter::Label->new('Sans 20', "Song\nAlbum");
+ $self->{'status'}->set_color(Clutter::Color->parse('White'));
+ $self->{'status'}->set_ellipsize('end');
+ $self->{'status'}->set_width($self->{'bg'}->get_width() - 20);
+
+ $self->{'block'}->add($self->{'bg'});
+ $self->{'block'}->add($self->{'status'});
+
Glib::Timeout->add_seconds(5, $self->can('display'), $self);
}