Skip to content

Instantly share code, notes, and snippets.

@kennyp
Created February 6, 2013 14:06
Show Gist options
  • Save kennyp/4722699 to your computer and use it in GitHub Desktop.
Save kennyp/4722699 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
use warnings;
use POSIX qw(setsid);
&daemonize;
exec("mplayer -really-quiet -noar /usr/share/sounds/gnome/default/alerts/glass.* &> /dev/null");
sub daemonize {
chdir '/' or die "Can't chdir to /: $!";
open STDIN, '/dev/null' or die "Can't read /dev/null: $!";
open STDOUT, '/dev/null' or die "Can't read /dev/null: $!";
defined(my $pid = fork) or die "Can't fork: $!";
exit if $pid;
setsid or die "Can't start a new session: $!";
umask 0;
}
use strict;
use Irssi;
use vars qw($VERSION %IRSSI);
$VERSION = '0.1';
%IRSSI = (
authors => 'Kenny Parnell',
contact => '[email protected]',
name => 'sounds',
description => 'Play sounds for different events in irssi.',
license => 'GNU General Public License'
);
sub priv_msg {
my ($server,$msg,$nick,$address,$target) = @_;
`~/.irssi/play-glass`;
}
Irssi::signal_add("message private", "priv_msg");
@iamdustan
Copy link

For the mac inclined:

exec("mplayer -really-quiet -noar /System/Library/Sounds/Purr.aiff &> /dev/null");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment