All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
5 use vars qw($VERSION %IRSSI);
10 contact=> 'bd@bc-bd.org',
12 description=> 'Displaye a small, changeing statusbar item to show irssi is still running',
14 url=> 'https://bc-bd.org/svn/repos/irssi/rotator',
17 # rotator Displaye a small, changeing statusbar item to show irssi is still running
18 # for irssi 0.8.4 by bd@bc-bd.org
24 # To use this script type f.e.:
26 # /statusbar window add -after more -alignment right rotator
28 # For more info on statusbars read the docs for /statusbar
34 # /set rotator_seperator <char>
35 # The character that is used to split the string in elements.
37 # /set rotator_chars <string>
38 # The string to display. Examples are:
40 # /set rotator_chars . o 0 O
41 # /set rotator_chars _ ¯
42 # /set rotator_chars %r %Y- %g-
44 # /set rotator_speed <int>
45 # The number of milliseconds to display every char.
46 # 1 second = 1000 milliseconds.
48 # /set rotator_bounce <ON|OFF>
49 # * ON : reverse direction at the end of rotator_chars
50 # * OFF : start from the beginning
58 # - checking rotator_speed to be > 10
61 # - added rotator_bounce
62 # - added rotator_seperator
63 # - added support for elements longer than one char
64 # - fixed displaying of special chars (thx to peder for pointing this one out)
72 my ($pos,$char,$timeout,$boundary,$direction);
77 my @rot = split(Irssi::settings_get_str('rotator_seperator'), Irssi::settings_get_str('rotator_chars'));
78 my $len = scalar @rot;
80 $char = quotemeta($rot[$pos]);
82 if ($pos == $boundary) {
83 if (Irssi::settings_get_bool('rotator_bounce')) {
97 Irssi::statusbar_items_redraw('rotator');
100 sub rotatorStatusbar() {
101 my ($item, $get_size_only) = @_;
103 $item->default_handler($get_size_only, "{sb ".$char."}", undef, 1);
107 my $time = Irssi::settings_get_int('rotator_speed');
109 Irssi::timeout_remove($timeout);
111 $boundary = scalar split(Irssi::settings_get_str('rotator_seperator'), Irssi::settings_get_str('rotator_chars')) -1;
116 Irssi::print("rotator: rotator_speed must be > 10");
118 $timeout = Irssi::timeout_add($time, 'rotatorTimeout' , undef);
122 Irssi::signal_add('setup changed', 'rotatorSetup');
124 Irssi::statusbar_item_register('rotator', '$0', 'rotatorStatusbar');
126 Irssi::settings_add_str('misc', 'rotator_chars', '. o 0 O 0 o');
127 Irssi::settings_add_str('misc', 'rotator_seperator', ' ');
128 Irssi::settings_add_int('misc', 'rotator_speed', 2000);
129 Irssi::settings_add_bool('misc', 'rotator_bounce', 1);
131 if (Irssi::settings_get_int('rotator_speed') < 10) {
132 Irssi::print("rotator: rotator_speed must be > 10");
134 $timeout = Irssi::timeout_add(Irssi::settings_get_int('rotator_speed'), 'rotatorTimeout' , undef);