un/away when
$ cat ~/bin/irssi_screen
#!/bin/bash
# Start a new screen session with irssi or attach to an already running one.
if screen -list | grep "\.irssi" > /dev/null
then # running
screen -x irssi
else # not running
screen -S irssi -t irssi irssi
fi
exit 0
$
/set browse_command ~/.irssi/irssi_browser %u
$ cat ~/.irssi/irssi_browser
#!/bin/sh
URL=$1
if [ "$SSH_CLIENT" ]; then
RHOST=$(echo $SSH_CLIENT | cut -f1 -d" ")
ssh $RHOST DISPLAY=:0 sensible-browser "$URL" > /dev/null
else
sensible-browser "$URL" >/dev/null &
fi
exit 0
$
note: this assumes that a connection to the client
is possible with ssh key authentication.$ grep irssi ~/.Xsession (/usr/bin/xterm -name irssi -e /usr/bin/ssh server -t ~/bin/irssi_screen & ) && (~/bin/irssi_screen_xscreensaver &) $note: this assumes that a connection to the server is possible with ssh key authentication.
un/away mode on the server.
$ cat ~/bin/irssi_screen_xscreensaver
#!/usr/bin/perl
my $blanked = 0;
open (IN, "xscreensaver-command -watch |");
while (<IN>) {
if (m/^(BLANK|LOCK)/) {
if (!$blanked) {
system 'ssh server screen -p irssi -X stuff "/away\ -all\ not\ here\ ...^M"'
$blanked = 1;
}
} elsif (m/^UNBLANK/) {
system 'ssh server screen -p irssi -X stuff "/away^M"';
$blanked = 0;
}
}
$
note: the "^M" should be a literal Ctrl-M
character, i.e. a CR (carriage return, "return", \13) & any
spaces in the irssi -X stuff command need to be escaped
with a \ (backslash).gregoa, 2006-11-24, 2006-11-25, 2007-01-23, 2007-05-24, 2009-04-17
