From 54cf5f5cf1f11e14d053b5f33db87de5cab04a20 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 10 Dec 2023 00:12:41 +0100 Subject: activity_bar.pl: Prevent adding the hook more than once The `enable` subcommand should be a no-op if the hook is already enabled. --- activity_bar.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/activity_bar.pl b/activity_bar.pl index 88a99e1..8f576c3 100644 --- a/activity_bar.pl +++ b/activity_bar.pl @@ -75,8 +75,9 @@ sub activity_bar_command_cb { if ($args eq 'disable') { anybar_send('hollow'); weechat::unhook($print_hook); + $print_hook = undef; } - if ($args eq 'enable') { + if ($args eq 'enable' && !$print_hook) { $print_hook = weechat::hook_print('', '', '', 0, 'print_cb', ''); } -- cgit v1.2.3