--- /dev/null
+package Display::Plugins::MPD;
+
+use Clutter;
+use Audio::MPD;
+use POSIX qw/strftime/;
+
+sub new {
+ my ($class,$stage) = @_;
+
+ my $self = {
+ 'stage' => $stage,
+ 'mpd' => Audio::MPD->new(),
+ 'file' => '',
+ 'active'=> 0,
+ };
+
+ bless ($self, $class);
+ $self->init();
+ return $self;
+}
+
+sub display {
+ my $self = shift;
+
+ my $current = $self->{'mpd'}->current();
+
+ if ($self->{'file'} ne $current->file()) {
+ my @lines = ();
+ push @lines, $current->title() if defined $current->title();
+ push @lines, $current->album() if defined $current->album();
+ push @lines, $current->artist() if defined $current->artist();
+
+ $self->{'status'}->set_text(join("\n", @lines));
+
+ $self->{'file'} = $current->file();
+
+ $self->{'bg'}->set_height($self->{'status'}->get_height() + 10);
+ $self->{'bg'}->set_anchor_point(1, $self->{'bg'}->get_height());
+ $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);
+
+ if (! $self->{'active'}) {
+ $self->{'stage'}->add($self->{'bg'});
+ $self->{'stage'}->add($self->{'status'});
+
+ $self->{'active'} = time() + 30;
+ }
+
+ Glib::Timeout->add_seconds(30, $self->can('hide_display'), $self);
+ }
+
+ return 1;
+}
+
+sub hide_display {
+ my $self = shift;
+
+ if ($self->{'active'} <= time()) {
+ $self->{'stage'}->remove($self->{'status'});
+ $self->{'stage'}->remove($self->{'bg'});
+
+ $self->{'active'} = 0;
+ }
+
+ return 0;
+}
+
+sub init {
+ my $self = shift;
+
+ $self->{'status'} = Clutter::Label->new('Sans 20', "Song\nAlbum");
+ $self->{'status'}->set_color(Clutter::Color->parse('White'));
+
+ $self->{'bg'} = Clutter::Rectangle->new(Clutter::Color->parse('Black'));
+ $self->{'bg'}->set_width($self->{'stage'}->get_width() - 40);
+ $self->{'bg'}->set_opacity(100);
+
+ Glib::Timeout->add_seconds(5, $self->can('display'), $self);
+}
+
+1;