Skip to content
Browse files

The initial import of the very basic griwlrssi

  • Loading branch information...
0 parents commit 5eb67a633d7b689c8e7f73ed939293f83fc2f559 @rgs committed May 6, 2010
Showing with 98 additions and 0 deletions.
  1. +25 −0 README
  2. +32 −0 griwlrssi.pl
  3. +24 −0 griwlrssid
  4. +17 −0 griwlrssid.plist
25 README
@@ -0,0 +1,25 @@
+griwlrssi
+---------
+
+A stupid, no-brainer, unconfigurable growl notifier for irssi->screen->ssh
+
+Features : none, apart from being very small and thus very hackable
+
+Requires : no cpan module ; the growlnotify utility
+
+Installation :
+
+1. put griwlrssid somewhere on the OS X box from where you access irssi
+ through ssh, executable bit being set
+2. eventually edit it so it finds the path to growlnotify (the command-line
+ utility that comes with growl, but should be installed separately)
+3. put griwlrssid.plist in ~/Library/LaunchAgents, and edit it so it
+ has the correct path to wherever you put griwlrssid. You might have to
+ use launchctl(1) to start it, or just log out and log in.
+4. put griwlrssi.pl in ~/.irssi/scripts on the irssi host, and load it
+ with the "/script load" command
+5. connect to the host with "ssh -R 9942:localhost:9942 hostname"
+ or put "RemoteForward 9942 localhost:9942" in your .ssh/config file.
+ If you don't like the port number 9942, replace it by another one more
+ to your liking in griwlrssi.pl and in griwlrssid.
+6. enjoy being notified
32 griwlrssi.pl
@@ -0,0 +1,32 @@
+#!perl
+#
+# An irssi script that sends priv msgs and hilights to a socket
+
+use strict;
+use Irssi;
+use IO::Socket;
+
+sub send_to_growl {
+ my ($title, $msg) = @_;
+ my $socket = IO::Socket::INET->new(
+ PeerHost => "localhost",
+ PeerPort => 9942,
+ Proto => "tcp",
+ );
+ if ($socket) {
+ print $socket "$title\n$msg\n";
+ close $socket;
+ }
+}
+
+Irssi::signal_add_last('message private', sub {
+ my (undef, $data, $nick) = @_;
+ send_to_growl("<$nick>", $data);
+});
+
+Irssi::signal_add_last('print text', sub {
+ my ($dest, undef, $stripped) = @_;
+ if ($dest->{level} & MSGLEVEL_HILIGHT) {
+ send_to_growl($dest->{target}, $stripped);
+ }
+});
24 griwlrssid
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+# A minimal daemon that forwards what it gets on a socket to growl
+
+use strict;
+use IO::Socket;
+
+my $port = 9942;
+my $notify = "$ENV{HOME}/bin/growlnotify";
+
+my $socket = IO::Socket::INET->new(
+ LocalHost => 'localhost',
+ LocalPort => $port,
+ Proto => 'tcp',
+ Listen => 5,
+);
+$socket or die "Couldn't create socket: $!\n";
+
+while (my $accept = $socket->accept) {
+ chomp( my $title = <$accept> );
+ chomp( my $message = join "", <$accept> );
+ system $notify, "-m", $message, $title;
+}
+
+END { close $socket }
17 griwlrssid.plist
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>Label</key>
+ <string>griwlrssid</string>
+ <key>Program</key>
+ <string>/Users/rafael/bin/griwlrssid</string>
+ <key>RunAtLoad</key>
+ <true/>
+ <key>KeepAlive</key>
+ <dict>
+ <key>NetworkState</key>
+ <true/>
+ </dict>
+</dict>
+</plist>

0 comments on commit 5eb67a6

Please sign in to comment.
Something went wrong with that request. Please try again.