]> git.rmz.io Git - dotfiles.git/commitdiff
weechat: update scripts
authorSamir Benmendil <me@rmz.io>
Tue, 6 Aug 2024 11:11:49 +0000 (12:11 +0100)
committerSamir Benmendil <me@rmz.io>
Tue, 6 Aug 2024 11:11:49 +0000 (12:11 +0100)
weechat/python/autosort.py
weechat/python/colorize_nicks.py
weechat/python/go.py
weechat/python/wee-slack

index 4312cda767c919e66bf66506d85f9caff95e2f09..73f27eb418c8f1e8559d433c38f33891f5bae2c1 100644 (file)
@@ -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 <maarten@de-vri.es>'
-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)'
index 10ffb71121991b732f57e929fcd790363a0735a9..bab12821c4e93ecd9e9a54a927d13acf2d4da775 100644 (file)
 #
 #
 # History:
+# 2023-10-30: Sébastien Helleu <flashcode@flashtux.org>
+#   version 32: revert to info "nick_color" with WeeChat >= 4.1.1
+# 2023-10-16: Sébastien Helleu <flashcode@flashtux.org>
+#   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 <xt@bash.no>"
-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
 
index 25041a8079665e5a59961624cb17ebf78ce7b4c3..c4f7f8ed55b2692acf8270a7fc4a56e8216bcc97 100644 (file)
 #
 # History:
 #
+# 2024-05-30, Sébastien Helleu <flashcode@flashtux.org>:
+#     version 3.0.1: refresh buffer input at the end of search
+# 2024-05-30, Sébastien Helleu <flashcode@flashtux.org>:
+#     version 3.0: refresh immediately buffer input when /go command is executed
+#                  (needed for WeeChat >= 4.3.0)
 # 2023-06-21, Sébastien Helleu <flashcode@flashtux.org>:
 #     version 2.9: add option "min_chars"
 # 2023-01-08, Sébastien Helleu <flashcode@flashtux.org>:
@@ -100,7 +105,7 @@ from __future__ import print_function
 
 SCRIPT_NAME = 'go'
 SCRIPT_AUTHOR = 'Sébastien Helleu <flashcode@flashtux.org>'
-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):
index 869c81eb79345f1da7b9ae91ad9fc8dc009603d1..f4fcf380e7baff9b84d32ac5c55fd8effd393119 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 869c81eb79345f1da7b9ae91ad9fc8dc009603d1
+Subproject commit f4fcf380e7baff9b84d32ac5c55fd8effd393119