# # window-cmd.pl - Even simpler window switching commands for irssi # by Ignacio R. Morelle # # Binds commands like /1, /2, /3, etc. for switching to the specified # window number in irssi. I'm sure something like this already existed # but I could not find it in the web. # # The original version binds from /1 to /99, which should probably be # more than enough for most users. It's very easy to change the range # of windows that are bound to these commands. # # This is public domain. Do whatever you want with it. # # WARNING: May contain small pieces that may be dangerous for little # children. # use strict; use warnings; use Irssi; use vars qw($VERSION %IRSSI); $VERSION = '0.1'; %IRSSI = ( authors => 'Ignacio R. Morelle', contact => 'shadowm2006@gmail.com', name => 'window-cmd', description => 'Even simpler /## window switching commands for irssi', license => 'Public Domain', url => 'http://shadowm.rewound.net/blog.pl/software/irssi_window_cmd.html', changed => '2009-10-24 05:52', ); # The following loop expression in parenthesis specifies the range of # windows that are bound to /## commands. I don't think anyone would # need more than 99 windows anyway... for my $n (1..99) { Irssi::command_bind("$n", sub { my $w; if(($w = Irssi::window_find_refnum($n))) { $w->set_active(); } 1; }); } 1;