diff options
Diffstat (limited to 'archive/.irssi/scripts/autorun/winnum.pl')
-rw-r--r-- | archive/.irssi/scripts/autorun/winnum.pl | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/archive/.irssi/scripts/autorun/winnum.pl b/archive/.irssi/scripts/autorun/winnum.pl new file mode 100644 index 00000000..e9ed0bc3 --- /dev/null +++ b/archive/.irssi/scripts/autorun/winnum.pl @@ -0,0 +1,41 @@ +# +# winnum.pl +# Goto a window by its reference number with /## +# +# +# Commands: +# /<window #> Go to window +# + +use strict; +use vars qw($VERSION %IRSSI); + +$VERSION = '1.0.0'; +%IRSSI = ( + authors => 'Trevor "tee" Slocum', + contact => 'tslocum@gmail.com', + name => 'WinNum', + description => 'Goto a window by its reference number with /##', + license => 'GPLv3', + url => 'https://github.com/tslocum/irssi-scripts', + changed => '2014-05-01' +); + +sub winnum_default_command { + my ($command, $server) = @_; + + $command =~ s/^\s+//; + $command =~ s/\s+$//; + my $winnum = ($command =~ /(\w+)/)[0]; + + if ($winnum =~ /^\d+$/) { + my $window = Irssi::window_find_refnum($winnum); + $window->set_active if $window; + + Irssi::signal_stop(); + } +} + +Irssi::signal_add_first("default command", "winnum_default_command"); + +print $IRSSI{name} . ': v' . $VERSION . ' loaded. Enter %9/<window #>%9 to goto a window.'; |