Created
February 12, 2012 04:24
-
-
Save TheLinx/1806338 to your computer and use it in GitHub Desktop.
irssi notifications
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
== SERVER: | |
- hilightcmd.pl goes in ~/.irssi/scripts/ (and autorun, symlink it) | |
- notify goes somewhere (make sure you put the path to it in the hilightcmd.pl file) | |
- irc goes somewhere (easiest: directly in ~) | |
== CLIENT: | |
- irssinotify-daemon.py somewhere (probably your bin folder) | |
- add an item to your .ssh/config, something like this: | |
Host uapps-irssi | |
Hostname uapps.org | |
User thelinx | |
Port 22 | |
RemoteForward 6151 localhost:6151 | |
- create a gnome-terminal profile called irssi that has a startup command of "ssh uapps-irssi -t ./irc" | |
- put irssi-client somewhere (probably your bin folder) | |
you will probably need to change any/all paths and names in these files. glhf. | |
make sure the ports in the ssh config, notify and irssinotify-daemon all match up | |
thanks to bartbes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use Irssi; | |
use vars qw($VERSION %IRSSI); | |
$VERSION = '1.0'; | |
%IRSSI = ( | |
authors => 'Matt "f0rked" Sparks', | |
contact => 'ms+irssi@quadpoint.org', | |
name => 'hilightcmd', | |
description => 'Executes command on hilight', | |
license => 'Public domain', | |
url => 'http://quadpoint.org', | |
changed => '2005-06-16', | |
); | |
# Run the command when away? | |
my $run_cmd_when_away = 0; | |
my $cmd_to_run = "/home/thelinx/bin/notify"; # CHANGE THIS | |
sub sig_printtext | |
{ | |
my($dest, $text, $stripped) = @_; | |
my $server = $dest->{server}; | |
# Do not run the command if we're not supposed to when away | |
return if ($server->{usermode_away} && !$run_cmd_when_away); | |
# Run the command if we're hilighted | |
if ((($dest->{level} & (MSGLEVEL_HILIGHT)) && | |
($dest->{level} & MSGLEVEL_NOHILIGHT) == 0)) { | |
system($cmd_to_run, Irssi::strip_codes($text)); | |
} | |
} | |
sub sig_privatemsg | |
{ | |
my($server, $msg, $nick, $address) = @_; | |
return if ($server->{usermode_away} && !$run_cmd_when_away); | |
system($cmd_to_run, Irssi::strip_codes("<${nick}> ${msg}")); | |
} | |
Irssi::signal_add("print text", \&sig_printtext); | |
Irssi::signal_add("message private", \&sig_privatemsg); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export LANG=en_US.UTF-8 | |
export LOCALE=en_US.UTF-8 | |
export TZ=CET | |
screen -aAdr -RR irc irssi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!/bin/bash | |
$HOME/.bin/irssinotify-daemon & | |
gnome-terminal --window-with-profile=irssi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
# made by bartbes | |
PORT = 6151 | |
import socket | |
import dbus | |
def notify(s): | |
s = s.strip() | |
end = s.find(">") | |
sender = s[1:end] | |
text = s[end+2:] | |
notifications.Notify("irssinotify", 0, "", sender, text, [], {"category": "im.received", "x-canonical-append": "allowed"}, -1) | |
bus = dbus.SessionBus() | |
notifications_proxy = bus.get_object("org.freedesktop.Notifications", "/org/freedesktop/Notifications") | |
notifications = dbus.Interface(notifications_proxy, "org.freedesktop.Notifications") | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.bind(("", PORT)) | |
s.listen(5) | |
while 1: | |
conn, addr = s.accept() | |
while 1: | |
data = conn.recv(4096) | |
if not data: | |
break | |
if data[:2] == ">>": | |
notify(data[2:]) | |
conn.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env tclsh | |
set port 6151 | |
if [catch [list socket localhost $port] sock] { | |
exit | |
} | |
catch [list puts $sock ">>[lindex $argv 0]"] | |
close $sock |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment