Skip to content

Commit 8b2dccf

Browse files
authored
Merge pull request #896 from Hravnkel/add-sb_separator-script
Added script sb_separator.pl
2 parents f587a92 + 983ad4e commit 8b2dccf

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

scripts/sb_separator.pl

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# $Id: sb_separator.pl,v 0.1 2025/10/14 21:40 Hravnkel $
2+
#
3+
# Run command '/statusbar additem -after user -alignment left -priority 1 separator' after loading sb_separator.pl.
4+
#
5+
6+
use strict;
7+
use warnings;
8+
use vars qw($VERSION %IRSSI);
9+
10+
use Irssi;
11+
$VERSION = '0.1';
12+
%IRSSI = (
13+
authors => 'Björn Sundberg',
14+
contact => '[email protected]',
15+
name => 'sb_separator',
16+
description => 'Displays up to three user defined separators in statusbar',
17+
modules => '',
18+
sbitems => 'separator separator_2 separator_3',
19+
license => 'GNU GPL v2',
20+
url => 'https://github.com/Hravnkel/irssi-sb_separator',
21+
changed => 'Sun Dec 21 20:24:45 CET 2025'
22+
);
23+
24+
use Irssi::TextUI;
25+
26+
my ($separator, $separator_2, $separator_3);
27+
28+
sub separator {
29+
my ($item, $get_size_only) = @_;
30+
31+
my $theme = Irssi::current_theme();
32+
my $separator = $theme->format_expand("{sb_separator}",
33+
Irssi::EXPAND_FLAG_IGNORE_EMPTY);
34+
35+
my $format = sprintf('{sb %s}', $separator);
36+
$item->default_handler($get_size_only, $format, undef, 1);
37+
}
38+
39+
40+
sub separator_2 {
41+
my ($item, $get_size_only) = @_;
42+
43+
my $theme = Irssi::current_theme();
44+
my $separator_2 = $theme->format_expand("{sb_separator_2}",
45+
Irssi::EXPAND_FLAG_IGNORE_EMPTY);
46+
47+
my $format = sprintf('{sb %s}', $separator_2);
48+
$item->default_handler($get_size_only, $format, undef, 1);
49+
}
50+
51+
sub separator_3 {
52+
my ($item, $get_size_only) = @_;
53+
54+
my $theme = Irssi::current_theme();
55+
my $separator_3 = $theme->format_expand("{sb_separator_3}",
56+
Irssi::EXPAND_FLAG_IGNORE_EMPTY);
57+
58+
my $format = sprintf('{sb %s}', $separator_3);
59+
$item->default_handler($get_size_only, $format, undef, 1);
60+
}
61+
62+
Irssi::statusbar_item_register('separator', '', 'separator');
63+
Irssi::statusbar_item_register('separator_2', '', 'separator_2');
64+
Irssi::statusbar_item_register('separator_3', '', 'separator_3');

0 commit comments

Comments
 (0)