summaryrefslogtreecommitdiff
path: root/.irssi
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2015-09-28 23:40:33 +0000
committerSean Whitton <spwhitton@spwhitton.name>2015-09-28 23:40:56 +0000
commit85ba3aea7d0b6560a2b9b5859a67b787d3dd9f4e (patch)
treebfeed3bf654d91022142de9611f6b91718db5ca4 /.irssi
parent1cf5e934e799011c0ee5e06e15b985c6742f9f10 (diff)
downloaddotfiles-85ba3aea7d0b6560a2b9b5859a67b787d3dd9f4e.tar.gz
more Irssi scripts
Diffstat (limited to '.irssi')
-rw-r--r--.irssi/scripts/autorun/act.pl44
-rw-r--r--.irssi/scripts/autorun/go.pl59
-rw-r--r--.irssi/scripts/autorun/winnum.pl41
3 files changed, 144 insertions, 0 deletions
diff --git a/.irssi/scripts/autorun/act.pl b/.irssi/scripts/autorun/act.pl
new file mode 100644
index 00000000..f7a75281
--- /dev/null
+++ b/.irssi/scripts/autorun/act.pl
@@ -0,0 +1,44 @@
+#!/usr/bin/perl -w
+# resets window activity status
+# by c0ffee
+# - http://www.penguin-breeder.org/irssi/
+
+#<scriptinfo>
+use strict;
+use vars qw($VERSION %IRSSI);
+
+use Irssi 20020120;
+$VERSION = "0.14";
+%IRSSI = (
+ authors => "c0ffee",
+ contact => "c0ffee\@penguin-breeder.org",
+ name => "Reset window activity status",
+ description => "Reset window activity status. defines command /act",
+ license => "Public Domain",
+ url => "http://www.penguin-breeder.org/irssi/",
+ changed => "Thu Apr 16 15:55:05 BST 2015",
+);
+#</scriptinfo>
+
+#
+# /ACT [PUBLIC|ALL]
+#
+# /ACT without parameters marks windows as non-active where no
+# public talk occured.
+#
+# /ACT PUBLIC also removes those where no nick hilight was triggered
+#
+# /ACT ALL sets all windows as non-active
+
+Irssi::command_bind('act', sub { _act(1); });
+Irssi::command_bind('act public', sub { _act(2); });
+Irssi::command_bind('act all', sub { _act(3); });
+
+sub _act {
+ my($level) = @_;
+ for (Irssi::windows()) {
+ if ($_->{data_level} <= $level) {
+ Irssi::signal_emit("window dehilight", $_);
+ }
+ }
+}
diff --git a/.irssi/scripts/autorun/go.pl b/.irssi/scripts/autorun/go.pl
new file mode 100644
index 00000000..b656a0fc
--- /dev/null
+++ b/.irssi/scripts/autorun/go.pl
@@ -0,0 +1,59 @@
+use strict;
+use vars qw($VERSION %IRSSI);
+use Irssi;
+use Irssi::Irc;
+
+# Usage:
+# /script load go.pl
+# If you are in #irssi you can type /go #irssi or /go irssi or even /go ir ...
+# also try /go ir<tab> and /go <tab> (that's two spaces)
+
+$VERSION = '1.01';
+
+%IRSSI = (
+ authors => 'nohar',
+ contact => 'nohar@freenode',
+ name => 'go to window',
+ description => 'Implements /go command that activates a window given a name/partial name. It features a nice completion.',
+ license => 'GPLv2 or later',
+ changed => '2014-10-19'
+);
+
+sub signal_complete_go {
+ my ($complist, $window, $word, $linestart, $want_space) = @_;
+ my $channel = $window->get_active_name();
+ my $k = Irssi::parse_special('$k');
+
+ return unless ($linestart =~ /^\Q${k}\Ego\b/i);
+
+ @$complist = ();
+ foreach my $w (Irssi::windows) {
+ my $name = $w->get_active_name();
+ if ($word ne "") {
+ if ($name =~ /\Q${word}\E/i) {
+ push(@$complist, $name)
+ }
+ } else {
+ push(@$complist, $name);
+ }
+ }
+ Irssi::signal_stop();
+};
+
+sub cmd_go
+{
+ my($chan,$server,$witem) = @_;
+
+ $chan =~ s/ *//g;
+ foreach my $w (Irssi::windows) {
+ my $name = $w->get_active_name();
+ if ($name =~ /^#?\Q${chan}\E/) {
+ $w->set_active();
+ return;
+ }
+ }
+}
+
+Irssi::command_bind("go", "cmd_go");
+Irssi::signal_add_first('complete word', 'signal_complete_go');
+
diff --git a/.irssi/scripts/autorun/winnum.pl b/.irssi/scripts/autorun/winnum.pl
new file mode 100644
index 00000000..e9ed0bc3
--- /dev/null
+++ b/.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.';