[look]
scroll_horiz = 10
show_current_line = on
+use_color = off
use_mute = off
value_search_char = "="
#
-# Copyright (C) 2008-2014 Sebastien Helleu <flashcode@flashtux.org>
-# Copyright (C) 2010-2015 Nils Görs <weechatter@arcor.de>
+# Copyright (C) 2008-2017 Sebastien Helleu <flashcode@flashtux.org>
+# Copyright (C) 2010-2017 Nils Görs <weechatter@arcor.de>
#
# 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
#
# History:
#
+# 2017-04-14, nils_2 <freenode.#weechat>
+# version 4.3: add option "use_color" (https://github.com/weechat/scripts/issues/93)
# 2016-07-08, nils_2 <weechatter@arcor.de>
# version 4.2: add diff function
# 2016-02-06, Sebastien Helleu <flashcode@flashtux.org>:
use strict;
my $PRGNAME = "iset";
-my $VERSION = "4.2";
+my $VERSION = "4.3";
my $DESCR = "Interactive Set for configuration options";
my $AUTHOR = "Sebastien Helleu <flashcode\@flashtux.org>";
my $LICENSE = "GPL3";
}
}
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";
$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
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2010-2015 Sébastien Helleu <flashcode@flashtux.org>
+# Copyright (C) 2010-2017 Sébastien Helleu <flashcode@flashtux.org>
#
# 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
#
# History:
#
+# 2017-06-21, Sébastien Helleu <flashcode@flashtux.org>:
+# version 1.0: rename command /autosetbuffer to /buffer_autoset
# 2015-09-28, Simmo Saan <simmo.saan@gmail.com>:
# version 0.9: instantly apply properties
# 2015-07-12, Sébastien Helleu <flashcode@flashtux.org>:
SCRIPT_NAME = "buffer_autoset"
SCRIPT_AUTHOR = "Sébastien Helleu <flashcode@flashtux.org>"
-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
# ================================[ 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)
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"))
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:
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):]
return weechat.WEECHAT_RC_OK
+
# ==================================[ main ]==================================
if __name__ == "__main__" and import_ok:
#
# History:
#
+# 2017-07-23, Sébastien Helleu <flashcode@flashtux.org>
+# 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
#
SCRIPT_NAME = "grep"
SCRIPT_AUTHOR = "Elián Hanisch <lambdae2@gmail.com>"
-SCRIPT_VERSION = "0.7.7"
+SCRIPT_VERSION = "0.7.8"
SCRIPT_LICENSE = "GPL3"
SCRIPT_DESC = "Search in buffers and logs"
SCRIPT_COMMAND = "grep"
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 ###
# -*- coding: utf-8 -*-
#
-# Copyright (c) 2012-2016 by nils_2 <weechatter@arcor.de>
+# Copyright (c) 2012-2017 by nils_2 <weechatter@arcor.de>
#
# add a plain text or evaluated content to item bar
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
+# 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)
#
SCRIPT_NAME = "text_item"
SCRIPT_AUTHOR = "nils_2 <weechatter@arcor.de>"
-SCRIPT_VERSION = "0.6"
+SCRIPT_VERSION = "0.7.1"
SCRIPT_LICENSE = "GPL"
SCRIPT_DESC = "add a plain text or evaluated content to item bar"
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)
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 + '.*')
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 ]===============================
'===========\n'
'Template:\n'
'/set plugins.var.python.text_item.<item_name> <type>|<signal> <${color:name/number}><text>\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',
'',
'',
'')