Showing posts with label growl. Show all posts
Showing posts with label growl. Show all posts

Friday, January 9, 2009

One last mac post then, taking a break on mac stuff

The things you should get when you get your mac for the first time.
Torrents = Transmission
Chat = Adium
Unix Ports = Macports (first install with macports irssi, but make sure you get irssi with perl, ie sudo port irssi +perl)
itunes for music of course(don't worry, it actually works on mac)
It already has perl, python, and ruby, so no worries there.
Oh and good cpan's to get
Mac::Growl
Mac::AppleScript
Very cool stuff. Oh and another very soon post is going to be about apple, however it's about a really fun exploit so it's for those of us who want to break into apples, which is probably everybody....and it's about the cute indie chick who's apple you want to break into, so even you die hard windows fan boys are going to like this one.

Using growl with irssi =, mac on irc

Growl is a really neat 3rd party app on the mac that loads a small fading information window on your screen when other applications send it information. So if you get a message on adium a little growl window pops up and tells you who and what they said temporarily, it's not as obtrusive as it sounds. So I have started on a script for irssi, to call growl. My script so far just displays the message that the person says, I haven't gotten it to say who says it yet. And it does something to the display in irrsi, and you have to hi command k, then ctrl-N back to your channel. You may notice the code is a little screwy, that's because originally I was just playing with the 8-ball.pl script on irssi's site. So thank you to Patrik Jansson, who wrote the 8-ball.pl script.

First you will need to make sure growl is installed. Second you will need the growl perl module which you can get by going to cpan in the terminal by typing:sudo cpan
Then you type install Mac::Growl
After it finishes installing make sure you have the scripts directory in ~/.irssi/ and then copy this perl file to it(~/.irssi/scripts/growl.pl):

#Irssi Growl
#
#
use strict;
use vars qw($VERSION %IRSSI);

use Irssi qw(command_bind signal_add);
use IO::File;
use Mac::Growl qw(:all);
$VERSION = '0.1';
%IRSSI = (
authors => 'Dusty Carver',
contact => 'bsdpunk@gmail.com',
name => 'irssiGrowl',
description => 'Growl for irssi',
license => 'GPL',
);

sub own_question {
my ($server, $msg, $target) = @_;
question($server, $msg, "", $target);
}

sub public_question {
my ($server, $msg, $nick, $address, $target) = @_;
question($server, $msg, $nick.": ", $target);
}
sub question($server, $msg, $nick, $target) {
my ($server, $msg, $nick, $target) = @_;
$_ = $msg;
if (!/^*bsdpunk/i) { return 0; }

if (/^*bsdpunk$/i){
Mac::Growl::RegisterNotifications(
# register your application in Growl before posting.
# just one time enough.
'irssiScript', # app name
['alert'], # all notification
['alert'], # default notification
);

Mac::Growl::PostNotification(
# post notification to Growl
"irssiScript", # app name
"alert", # notification type
"irssi", # alert title
"$_", # alert content
);
return 0;
} else {
if(!/^bsdpunk says/i){
return 0;
}
}

}

signal_add("message public", "public_question");
signal_add("message own_public", "own_question");