aboutsummaryrefslogtreecommitdiffstats
path: root/activity_bar.pl
blob: c61209275b56e366eb7291d742d56a6e688fd979 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use strict;
use warnings;

weechat::register(
	'activity_bar',
	'Teddy Wing',
	'1.0',
	'GPL-3.0-or-later',
	'Monitor activity in all buffers and update AnyBar',
	'',
	''
);

weechat::hook_print('', '', '', 0, 'print_cb', '');

sub print_cb {
	my ($data, $buffer, $date, $tags, $displayed, $highlight, $prefix, $message) = @_;

	my $buffer_type = weechat::buffer_get_string($buffer, 'localvar_type');
	my $buffer_name = weechat::buffer_get_string($buffer, 'short_name');

	if ($buffer_type eq 'private') {
		weechat::print('', "Private message in $buffer_name: $message");
	}
	elsif ($highlight == 1) {
		weechat::print('', "Highlight in $buffer_name: $message");
	}
	else {
		weechat::print('', "Message in $buffer_name: $message");
	}

	return weechat::WEECHAT_RC_OK;
}