aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2023-12-10 00:12:41 +0100
committerTeddy Wing2023-12-10 00:12:41 +0100
commit54cf5f5cf1f11e14d053b5f33db87de5cab04a20 (patch)
treea99067946cd60acd455fd04b718ac0ff78e77193
parent4b88f1b09914c8d54da52af942461c0cd4eecec1 (diff)
downloadweechat-activity-bar-54cf5f5cf1f11e14d053b5f33db87de5cab04a20.tar.bz2
activity_bar.pl: Prevent adding the hook more than once
The `enable` subcommand should be a no-op if the hook is already enabled.
-rw-r--r--activity_bar.pl3
1 files changed, 2 insertions, 1 deletions
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', '');
}