#!/usr/bin/perl use strict; use warnings; use Glib qw( :constants ); use Clutter qw( :gst-init ); use FindBin qw(); my $stage = Clutter::Stage->get_default(); $stage->set_size(400, 300); $stage->set_color(Clutter::Color->parse('DarkSlateGray')); $stage->set_user_resizable(TRUE); $stage->signal_connect('key-press-event' => sub { Clutter->main_quit() }); my $icon = Clutter::Texture->new("$FindBin::Bin/speaker.png"); $icon->set_anchor_point( $icon->get_width() / 2, $icon->get_height() / 2 ); $icon->set_position( $stage->get_width() / 2, $stage->get_height() / 2 ); $icon->set_opacity(127); $icon->set_reactive(TRUE); $icon->signal_connect('enter-event' => sub { $icon->set_opacity(255); }); $icon->signal_connect('leave-event' => sub { $icon->set_opacity(127); }); $stage->add($icon); my $audio = Clutter::Gst::Audio->new; $audio->set_filename("$FindBin::Bin/bell.ogg"); $icon->signal_connect( 'button-press-event' => sub { $audio->set_playing(TRUE); } ); $stage->show_all(); Clutter->main(); exit;