From: Samir Benmendil Date: Tue, 6 Aug 2024 11:11:49 +0000 (+0100) Subject: weechat: update scripts X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/baa632db79e8be6b0af4359cc4b678225672be72 weechat: update scripts --- diff --git a/weechat/python/autosort.py b/weechat/python/autosort.py index 4312cda..73f27eb 100644 --- a/weechat/python/autosort.py +++ b/weechat/python/autosort.py @@ -25,6 +25,8 @@ # # Changelog: +# 3.10: +# * Fix exception in `/autosort helpers swap`. # 3.9: # * Remove `buffers.pl` from recommended settings. # 3,8: @@ -87,7 +89,7 @@ import weechat SCRIPT_NAME = 'autosort' SCRIPT_AUTHOR = 'Maarten de Vries ' -SCRIPT_VERSION = '3.9' +SCRIPT_VERSION = '3.10' SCRIPT_LICENSE = 'GPL3' SCRIPT_DESC = 'Flexible automatic (or manual) buffer sorting based on eval expressions.' @@ -616,7 +618,6 @@ def command_helper_swap(buffer, command, args): except KeyError as e: raise HumanReadableError('No such helper: {0}'.format(e.args[0])) - config.helpers.swap(index_a, index_b) config.save_helpers() command_helper_list(buffer, command, '') return weechat.WEECHAT_RC_OK @@ -829,7 +830,7 @@ def on_autosort_command(data, buffer, args): def add_completions(completion, words): for word in words: - weechat.hook_completion_list_add(completion, word, 0, weechat.WEECHAT_LIST_POS_END) + weechat.completion_list_add(completion, word, 0, weechat.WEECHAT_LIST_POS_END) def autosort_complete_rules(words, completion): if len(words) == 0: @@ -1001,14 +1002,14 @@ If you remove all signals you can still sort your buffers manually with the {*white}# Recommended settings For the best visual effect, consider setting the following options: - {*white}/set {cyan}irc.look.server_buffer{reset} {brown}independent{reset} +{*white}/set {cyan}irc.look.server_buffer{reset} {brown}independent{reset} This setting allows server buffers to be sorted independently, which is needed to create a hierarchical tree view of the server and channel buffers. If you are using the {*default}buflist{reset} plugin you can (ab)use Unicode to draw a tree structure with the following setting (modify to suit your need): - {*white}/set {cyan}buflist.format.indent {brown}"${{color:237}}${{if:${{buffer.next_buffer.local_variables.type}}=~^(channel|private)$?├─:└─}}"{reset} +{*white}/set {cyan}buflist.format.indent {brown}"${{color:237}}${{if:${{buffer.next_buffer.local_variables.type}}=~^(channel|private)$?├─:└─}}"{reset} ''' command_completion = '%(plugin_autosort) %(plugin_autosort) %(plugin_autosort) %(plugin_autosort) %(plugin_autosort)' diff --git a/weechat/python/colorize_nicks.py b/weechat/python/colorize_nicks.py index 10ffb71..bab1282 100644 --- a/weechat/python/colorize_nicks.py +++ b/weechat/python/colorize_nicks.py @@ -21,6 +21,10 @@ # # # History: +# 2023-10-30: Sébastien Helleu +# version 32: revert to info "nick_color" with WeeChat >= 4.1.1 +# 2023-10-16: Sébastien Helleu +# version 31: use info "irc_nick_color" on IRC buffers with WeeChat >= 4.1.0 # 2022-11-07: mva # version 30: add ":" and "," to VALID_NICK regexp, # to don't reset colorization in input_line @@ -96,7 +100,7 @@ w = weechat SCRIPT_NAME = "colorize_nicks" SCRIPT_AUTHOR = "xt " -SCRIPT_VERSION = "30" +SCRIPT_VERSION = "32" SCRIPT_LICENSE = "GPL" SCRIPT_DESC = "Use the weechat nick colors in the chat area" @@ -171,11 +175,15 @@ def colorize_config_read(): global colorize_config_file return weechat.config_read(colorize_config_file) -def colorize_nick_color(nick, my_nick): +def colorize_nick_color(buffer, nick, my_nick): ''' Retrieve nick color from weechat. ''' if nick == my_nick: return w.color(w.config_string(w.config_get('weechat.color.chat_nick_self'))) else: + version = int(w.info_get('version_number', '') or 0) + if w.buffer_get_string(buffer, 'plugin') == 'irc' and version == 0x4010000: + server = w.buffer_get_string(buffer, 'localvar_server') + return w.info_get('irc_nick_color', '%s,%s' % (server, nick)) return w.info_get('nick_color', nick) def colorize_cb(data, modifier, modifier_data, line): @@ -343,7 +351,7 @@ def populate_nicks(*args): continue nick = w.infolist_string(nicklist, 'name') - nick_color = colorize_nick_color(nick, my_nick) + nick_color = colorize_nick_color(buffer_ptr, nick, my_nick) colored_nicks[buffer_ptr][nick] = nick_color @@ -365,7 +373,7 @@ def add_nick(data, signal, type_data): colored_nicks[pointer] = {} my_nick = w.buffer_get_string(pointer, 'localvar_nick') - nick_color = colorize_nick_color(nick, my_nick) + nick_color = colorize_nick_color(pointer, nick, my_nick) colored_nicks[pointer][nick] = nick_color diff --git a/weechat/python/go.py b/weechat/python/go.py index 25041a8..c4f7f8e 100644 --- a/weechat/python/go.py +++ b/weechat/python/go.py @@ -21,6 +21,11 @@ # # History: # +# 2024-05-30, Sébastien Helleu : +# version 3.0.1: refresh buffer input at the end of search +# 2024-05-30, Sébastien Helleu : +# version 3.0: refresh immediately buffer input when /go command is executed +# (needed for WeeChat >= 4.3.0) # 2023-06-21, Sébastien Helleu : # version 2.9: add option "min_chars" # 2023-01-08, Sébastien Helleu : @@ -100,7 +105,7 @@ from __future__ import print_function SCRIPT_NAME = 'go' SCRIPT_AUTHOR = 'Sébastien Helleu ' -SCRIPT_VERSION = '2.9' +SCRIPT_VERSION = '3.0.1' SCRIPT_LICENSE = 'GPL3' SCRIPT_DESC = 'Quick jump to buffers' @@ -215,6 +220,7 @@ def go_unhook_all(): go_unhook_one('modifier') for hook in HOOK_COMMAND_RUN: go_unhook_one(hook) + weechat.bar_item_update('input_text') def go_hook_all(): @@ -234,6 +240,7 @@ def go_hook_all(): if 'modifier' not in hooks: hooks['modifier'] = weechat.hook_modifier( 'input_text_display_with_cursor', 'go_input_modifier', '') + weechat.bar_item_update('input_text') def go_start(buf): diff --git a/weechat/python/wee-slack b/weechat/python/wee-slack index 869c81e..f4fcf38 160000 --- a/weechat/python/wee-slack +++ b/weechat/python/wee-slack @@ -1 +1 @@ -Subproject commit 869c81eb79345f1da7b9ae91ad9fc8dc009603d1 +Subproject commit f4fcf380e7baff9b84d32ac5c55fd8effd393119