From: Samir Benmendil Date: Sat, 23 Sep 2017 12:04:31 +0000 (+0000) Subject: weechat: update plugins X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/f07f9d2d3f47ad933d843129c0d280c1c56ce6a9 weechat: update plugins --- diff --git a/weechat/iset.conf b/weechat/iset.conf index 35e1653..8508e97 100644 --- a/weechat/iset.conf +++ b/weechat/iset.conf @@ -33,5 +33,6 @@ show_plugin_description = off [look] scroll_horiz = 10 show_current_line = on +use_color = off use_mute = off value_search_char = "=" diff --git a/weechat/perl/iset.pl b/weechat/perl/iset.pl index 163dfb5..d6c9364 100644 --- a/weechat/perl/iset.pl +++ b/weechat/perl/iset.pl @@ -1,6 +1,6 @@ # -# Copyright (C) 2008-2014 Sebastien Helleu -# Copyright (C) 2010-2015 Nils Görs +# Copyright (C) 2008-2017 Sebastien Helleu +# Copyright (C) 2010-2017 Nils Görs # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -19,6 +19,8 @@ # # History: # +# 2017-04-14, nils_2 +# version 4.3: add option "use_color" (https://github.com/weechat/scripts/issues/93) # 2016-07-08, nils_2 # version 4.2: add diff function # 2016-02-06, Sebastien Helleu : @@ -130,7 +132,7 @@ use strict; my $PRGNAME = "iset"; -my $VERSION = "4.2"; +my $VERSION = "4.3"; my $DESCR = "Interactive Set for configuration options"; my $AUTHOR = "Sebastien Helleu "; my $LICENSE = "GPL3"; @@ -619,6 +621,10 @@ sub iset_refresh_line } } my $value = $options_values[$y]; + if (weechat::config_boolean($options_iset{"use_color"}) == 1 and $options_types[$y] eq "color") + { + $value = weechat::color($options_values[$y]) . $options_values[$y]; + } if ($options_is_null[$y]) { $value = "null"; @@ -1509,6 +1515,10 @@ sub iset_config_init $iset_config_file, $section_look, "use_mute", "boolean", "/mute command will be used in input bar", "", 0, 0, "off", "off", 0, "", "", "", "", "", ""); + $options_iset{"use_color"} = weechat::config_new_option( + $iset_config_file, $section_look, + "use_color", "boolean", "display the color value in the corresponding color", "", 0, 0, + "off", "off", 0, "", "", "full_refresh_cb", "", "", ""); } sub iset_config_reload_cb diff --git a/weechat/python/buffer_autoset.py b/weechat/python/buffer_autoset.py index 305bd6b..c33d3ad 100644 --- a/weechat/python/buffer_autoset.py +++ b/weechat/python/buffer_autoset.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2010-2015 Sébastien Helleu +# Copyright (C) 2010-2017 Sébastien Helleu # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -22,6 +22,8 @@ # # History: # +# 2017-06-21, Sébastien Helleu : +# version 1.0: rename command /autosetbuffer to /buffer_autoset # 2015-09-28, Simmo Saan : # version 0.9: instantly apply properties # 2015-07-12, Sébastien Helleu : @@ -46,11 +48,11 @@ SCRIPT_NAME = "buffer_autoset" SCRIPT_AUTHOR = "Sébastien Helleu " -SCRIPT_VERSION = "0.9" +SCRIPT_VERSION = "1.0" SCRIPT_LICENSE = "GPL3" SCRIPT_DESC = "Auto-set buffer properties when a buffer is opened" -SCRIPT_COMMAND = "autosetbuffer" +SCRIPT_COMMAND = SCRIPT_NAME import_ok = True @@ -143,7 +145,7 @@ def bas_config_write(): # ================================[ command ]================================= def bas_cmd(data, buffer, args): - """Callback for /autosetbuffer command.""" + """Callback for /buffer_autoset command.""" args = args.strip() if args == "": weechat.command("", "/set %s.buffer.*" % CONFIG_FILE_NAME) @@ -172,7 +174,7 @@ def bas_completion_current_buffer_cb(data, completion_item, buffer, completion): """ Complete with current buffer name (plugin.name), - for command '/autosetbuffer'. + for command '/buffer_autoset'. """ name = "%s.%s" % (weechat.buffer_get_string(buffer, "plugin"), weechat.buffer_get_string(buffer, "name")) @@ -182,7 +184,7 @@ def bas_completion_current_buffer_cb(data, completion_item, buffer, def bas_completion_options_cb(data, completion_item, buffer, completion): - """Complete with config options, for command '/autosetbuffer'.""" + """Complete with config options, for command '/buffer_autoset'.""" options = weechat.infolist_get("option", "", "%s.buffer.*" % CONFIG_FILE_NAME) if options: @@ -240,11 +242,12 @@ def bas_signal_buffer_opened_cb(data, signal, signal_data): weechat.buffer_get_string(buffer, "full_name")) return weechat.WEECHAT_RC_OK + def bas_config_option_cb(data, option, value): if not weechat.config_boolean(bas_options["look_instant"]): return weechat.WEECHAT_RC_OK - if not weechat.config_get(option): # option was deleted + if not weechat.config_get(option): # option was deleted return weechat.WEECHAT_RC_OK option = option[len("%s.buffer." % CONFIG_FILE_NAME):] @@ -267,6 +270,7 @@ def bas_config_option_cb(data, option, value): return weechat.WEECHAT_RC_OK + # ==================================[ main ]================================== if __name__ == "__main__" and import_ok: diff --git a/weechat/python/grep.py b/weechat/python/grep.py index 30bf2a6..24ab0c4 100644 --- a/weechat/python/grep.py +++ b/weechat/python/grep.py @@ -66,6 +66,9 @@ # # History: # +# 2017-07-23, Sébastien Helleu +# version 0.7.8: fix modulo by zero when nick is empty string +# # 2016-06-23, mickael9 # version 0.7.7: fix get_home function # @@ -206,7 +209,7 @@ except ImportError: SCRIPT_NAME = "grep" SCRIPT_AUTHOR = "Elián Hanisch " -SCRIPT_VERSION = "0.7.7" +SCRIPT_VERSION = "0.7.8" SCRIPT_LICENSE = "GPL3" SCRIPT_DESC = "Search in buffers and logs" SCRIPT_COMMAND = "grep" @@ -378,13 +381,15 @@ def color_nick(nick): else: mode = mode_color = '' # nick color - nick_color = weechat.info_get('irc_nick_color', nick) - if not nick_color: - # probably we're in WeeChat 0.3.0 - #debug('no irc_nick_color') - color_nicks_number = config_int('weechat.look.color_nicks_number') - idx = (sum(map(ord, nick))%color_nicks_number) + 1 - nick_color = wcolor(config_string('weechat.color.chat_nick_color%02d' %idx)) + nick_color = '' + if nick: + nick_color = weechat.info_get('irc_nick_color', nick) + if not nick_color: + # probably we're in WeeChat 0.3.0 + #debug('no irc_nick_color') + color_nicks_number = config_int('weechat.look.color_nicks_number') + idx = (sum(map(ord, nick))%color_nicks_number) + 1 + nick_color = wcolor(config_string('weechat.color.chat_nick_color%02d' %idx)) return ''.join((prefix_c, prefix, mode_color, mode, nick_color, nick, suffix_c, suffix)) ### Config and value validation ### diff --git a/weechat/python/text_item.py b/weechat/python/text_item.py index 4b63a81..47b284f 100644 --- a/weechat/python/text_item.py +++ b/weechat/python/text_item.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (c) 2012-2016 by nils_2 +# Copyright (c) 2012-2017 by nils_2 # # add a plain text or evaluated content to item bar # @@ -17,6 +17,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # +# 2017-08-23: nils_2, (freenode.#weechat) +# 0.7.1 : improve /help text +# +# 2017-08-19: nils_2, (freenode.#weechat) +# 0.7 : add type "!all", internal changes +# # 2016-12-12: nils_2, (freenode.#weechat) # 0.6 : fix problem with multiple windows (reported by Ram-Z) # @@ -50,7 +56,7 @@ except Exception: SCRIPT_NAME = "text_item" SCRIPT_AUTHOR = "nils_2 " -SCRIPT_VERSION = "0.6" +SCRIPT_VERSION = "0.7.1" SCRIPT_LICENSE = "GPL" SCRIPT_DESC = "add a plain text or evaluated content to item bar" @@ -76,19 +82,15 @@ def unhook(hook): def toggle_refresh(pointer, name, value): option_name = name[len('plugins.var.python.' + SCRIPT_NAME + '.'):] # get optionname - # option was removed? remove bar_item from struct! + # option was removed? remove bar_item from struct if not weechat.config_get_plugin(option_name): ptr_bar = weechat.bar_item_search(option_name) if ptr_bar: weechat.bar_item_remove(ptr_bar) - return weechat.WEECHAT_RC_OK - else: - return weechat.WEECHAT_RC_OK + return weechat.WEECHAT_RC_OK - # check if option is new or simply changed - if weechat.bar_item_search(option_name): - weechat.bar_item_update(option_name) - else: + # check if option is new or changed + if not weechat.bar_item_search(option_name): weechat.bar_item_new(option_name,'update_item',option_name) weechat.bar_item_update(option_name) @@ -122,18 +124,14 @@ def update_item (data, item, window): window = weechat.current_window() value = weechat.config_get_plugin(data) - - if value: - value = check_buffer_type(window, data, value) - else: - return "" - if not value: return "" + value = check_buffer_type(window, data, value) + return substitute_colors(value,window) -# update item +# update item from weechat.hook_signal() def bar_item_update(signal, callback, callback_data): ptr_infolist_option = weechat.infolist_get('option','','plugins.var.python.' + SCRIPT_NAME + '.*') @@ -184,6 +182,10 @@ def check_buffer_type(window, data, value): if channel_type == 'all' or weechat.buffer_get_string(bufpointer,'localvar_type') == channel_type: return value + if channel_type == '!all': + a = ["channel","server","private"] + if weechat.buffer_get_string(bufpointer,'localvar_type') in a: + return value return "" # ================================[ main ]=============================== @@ -195,19 +197,20 @@ if __name__ == "__main__": '===========\n' 'Template:\n' '/set plugins.var.python.text_item. | <${color:name/number}>\n\n' - ' type : all, channel, server, private\n' - ' (you can use: /buffer localvar)\n\n' - ' signal (eg.): buffer_switch, buffer_closing, print, \n' + ' type : channel, server, private, all (all kind of buffers e.g. /color, /fset...) and !all (channel, server and private buffer)\n' + ' (see: /buffer localvar)\n\n' + ' signal (eg.): buffer_switch, buffer_closing, print, mouse_enabled\n' ' (for a list of all possible signals, see API doc weechat_hook_signal())\n\n' - 'Example:\n' - '=======\n' + 'Examples:\n' 'creates an option for a text item named "nick_text". The item will be created for "channel" buffers. ' 'The text displayed in the status-bar is "Nicks:" (yellow colored!):\n' ' /set plugins.var.python.text_item.nick_text "channel ${color:yellow}Nicks:"\n\n' 'now you have to add the item "nick_text" to the bar.items (use auto-completion or iset.pl!)\n' ' /set weechat.bar.status.items nick_text\n\n' - 'creates an option to display the terminal width and height in an item bar. item will be updated on signal "signal_sigwinch"\n' - ' /set plugins.var.python.text_item.dimension "all|signal_sigwinch width: ${info:term_width} height: ${info:term_height}"\n', + 'creates an option to display the terminal width and height in an item bar. item will be updated on signal "signal_sigwinch":\n' + ' /set plugins.var.python.text_item.dimension "all|signal_sigwinch width: ${info:term_width} height: ${info:term_height}"\n' + 'creates an option to display the status from "/filter toggle" and "/filter toggle @" command, item name is "filter_item":\n' + ' /set plugins.var.python.text_item.filter_item "!all|*filters* ${if:${info:filters_enabled}==1?${color:yellow}F:${color:243}F}${if:${buffer.filter}==1?${color:yellow}@:${color:243}@}"\n', '', '', '')