Source

pcw / pcw_win.sh

#!/bin/sh
#
# This is the script run by pcw when you join a new channel or a new message
# comes in.  CPATH is the path to the directory, OUT and IN are the out file
# in fifo respectively, and NICK is the nick passed to pcw or the empty string
# if no nick was passed in.
#
# These are just a few examples, and I trust that you can figure out how to do
# other stuff.  Of note, pcw decides when to run the command based on the
# status of the last command it ran for a given 'path'.  If the child is still
# alive it will not run the command again (helpful for open terminals).  This
# does mean however that some ideas won't work out of the box, for instance
# using urxvtc or screen.  You should be able to keep track of some stuff here
# in order to decide whether or not to launch a new window, have fun!

CPATH="$1"
OUT="$2"
IN="$3"
NICK="$4"

exec urxvt -title "$CPATH" -e srw -p "$(basename "$CPATH")> " cw "$OUT" "$IN"

#
# The default command
# exec urxvt -title "$CPATH" -e srw -p "$(basename "$CPATH")> " cw "$OUT" "$IN"
#
# If for some reason you really don't want to use srw...
# exec urxvt -title "$CPATH" -e cw "$OUT" "$IN"
#
# For colors, bell on nick, better line wrapping etc.
# exec urxvt -title "$CPATH" -e srw -p "$(basename "$CPATH")> " cw_color.sh -i "$OUT" -o "$IN" -n "$NICK"
# 
# If you want to use tabbed (http://tools.suckless.org/tabbed) so each new
# channel has it's own tab.  Start tabbed with -d then export the window id as
# pcw_window_id (or whatever you want...) then start pcw.  It should be fairly
# simple to do that in a script, use cw_color.sh if you want the colors etc.
# exec urxvt -embed "$pcw_window_id" -title "$CPATH", -e srw -p "$(basename "$CPATH")> " cw "$OUT" "$IN"
#
# If you want notifications in dzen, then click on a specific message to spawn
# a terminal for that channel.
# NOTE: alpha quality at best, more of a proff of concept, but have fun with it
# pcw_notify.sh "$CPATH" "$NICK"