def _add_infobar(): """add the infobar for moc_control""" version = int(weechat.info_get('version_number', '')) or 0 if version >= 0x02090000: weechat.bar_new(SCRIPT_NAME, "off", "750", "window", "", "bottom", "horizontal", "vertical", "1", "0", "default", "blue", "cyan", "cyan", "off", "[moc_infobar]") else: weechat.bar_new(SCRIPT_NAME, "off", "750", "window", "", "bottom", "horizontal", "vertical", "1", "0", "default", "blue", "cyan", "off", "[moc_infobar]")
def main(): if not init(): return weechat.hook_command(SCRIPT_COMMAND, SCRIPT_DESC, "[cmd1 | cmd2]", " cmd1: comand1\n" " cmd2: command2\n", "cmd1 example", "bee_cmd", "") weechat.bar_item_new(bar_item, "bee_item_cb", ""); weechat.bar_new(bar_name, "on", "0", "root", "", "top", "horizontal", "vertical", "0", "0", "default", "default", "default", "0", bar_item); return
if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT_DESC, "", ""): # Set default settings for option, default_value in settings.items(): if not weechat.config_is_set_plugin(option): weechat.config_set_plugin(option, default_value) weechat.hook_command( SCRIPT_COMMAND, "URL bar control", "[list | hide | show | toggle | url URL]", " list: list all URL and show URL bar\n" " hide: hide URL bar\n" " show: show URL bar\n" " toggle: toggle showing of URL bar\n", "list || hide || show || toggle || url %(urlbar_urls)", "urlbar_cmd", "") weechat.hook_completion("urlbar_urls", "list of URLs", "urlbar_completion_urls_cb", "") weechat.bar_item_new("urlbar_urls", "urlbar_item_cb", "") version = int(weechat.info_get('version_number', '')) or 0 if version >= 0x02090000: weechat.bar_new("urlbar", "on", "0", "root", "", "top", "horizontal", "vertical", "0", "0", "default", "default", "default", "default", "0", "urlbar_urls") else: weechat.bar_new("urlbar", "on", "0", "root", "", "top", "horizontal", "vertical", "0", "0", "default", "default", "default", "0", "urlbar_urls") weechat.hook_print("", "", "://", 1, "urlbar_print_cb", "")
# Set up script options. for option, value in vimode_settings.items(): if weechat.config_is_set_plugin(option): vimode_settings[option] = weechat.config_get_plugin(option) else: weechat.config_set_plugin(option, value[0]) vimode_settings[option] = value[0] weechat.config_set_desc_plugin( option, "%s (default: \"%s\")" % (value[1], value[0])) # Warn the user about possible problems if necessary. if not weechat.config_string_to_boolean(vimode_settings['no_warn']): check_warnings() # Create bar items and setup hooks. weechat.bar_item_new("mode_indicator", "cb_mode_indicator", '') weechat.bar_item_new("cmd_text", "cb_cmd_text", '') weechat.bar_item_new("vi_buffer", "cb_vi_buffer", '') vi_cmd = weechat.bar_new("vi_cmd", "off", "0", "root", '', "bottom", "vertical", "vertical", "0", "0", "default", "default", "default", "0", "cmd_text") weechat.hook_config('plugins.var.python.%s.*' % SCRIPT_NAME, 'cb_config', '') weechat.hook_signal("key_pressed", "cb_key_pressed", '') weechat.hook_signal("key_combo_default", "cb_key_combo_default", '') weechat.hook_command( "vimode", SCRIPT_DESC, "[help | bind_keys [--list]]", " help: show help\n" "bind_keys: unbind problematic keys, and bind" " recommended keys to use in WeeChat\n" " --list: only list changes", "help || bind_keys |--list", "cb_vimode_cmd", '')
vimode_settings[option] = weechat.config_get_plugin(option) else: weechat.config_set_plugin(option, value[0]) vimode_settings[option] = value[0] weechat.config_set_desc_plugin( option, "%s (default: \"%s\")" % (value[1], value[0])) # Warn the user about possible problems if necessary. if not weechat.config_string_to_boolean(vimode_settings['no_warn']): check_warnings() # Create bar items and setup hooks. weechat.bar_item_new("mode_indicator", "cb_mode_indicator", "") weechat.bar_item_new("cmd_text", "cb_cmd_text", "") weechat.bar_item_new("vi_buffer", "cb_vi_buffer", "") weechat.bar_item_new("line_numbers", "cb_line_numbers", "") weechat.bar_new("vi_cmd", "off", "0", "root", "", "bottom", "vertical", "vertical", "0", "0", "default", "default", "default", "0", "cmd_text") weechat.bar_new("vi_line_numbers", "on", "0", "window", "", "left", "vertical", "vertical", "0", "0", "default", "default", "default", "0", "line_numbers") weechat.hook_config("plugins.var.python.%s.*" % SCRIPT_NAME, "cb_config", "") weechat.hook_signal("key_pressed", "cb_key_pressed", "") weechat.hook_signal("key_combo_default", "cb_key_combo_default", "") weechat.hook_signal("buffer_switch", "cb_update_line_numbers", "") weechat.hook_command( "vimode", SCRIPT_DESC, "[help | bind_keys [--list]]", " help: show help\n" "bind_keys: unbind problematic keys, and bind" " recommended keys to use in WeeChat\n" " --list: only list changes", "help || bind_keys |--list",
# Show the command line when needed, hide it (and update vi_buffer since # we'd be looking for keystrokes instead) otherwise. if cmd_text != '': weechat.command('', "/bar show vi_cmd") weechat.bar_item_update("cmd_text") else: weechat.command('', "/bar hide vi_cmd") if is_printing(signal_data, pressed_keys): vi_buffer += signal_data pressed_keys += signal_data # Check for any matching bound keys. weechat.hook_timer(1, 0, 1, "pressed_keys_check", '') last_time = time.time() # Clear the buffers after some time. weechat.hook_timer(1000, 0, 1, "clear_vi_buffers", "check_time") weechat.bar_item_update("vi_buffer") return weechat.WEECHAT_RC_OK weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT_DESC, '', '') weechat.bar_item_new("mode_indicator", "mode_indicator_cb", '') weechat.bar_item_new("cmd_text", "cmd_text_cb", '') weechat.bar_item_new("vi_buffer", "vi_buffer_cb", '') vi_cmd = weechat.bar_new("vi_cmd", "off", "0", "root", '', "bottom", "vertical", "vertical", "0", "0", "default", "default", "default", "0", "cmd_text") weechat.hook_signal("key_pressed", "key_pressed_cb", '')
def _add_infobar(): """add the infobar for moc_control""" weechat.bar_new(SCRIPT_NAME, "off", "750", "window", "", "bottom", "horizontal", "vertical", "1", "0", "default", "blue", "cyan", "off", "[moc_infobar]")
if weechat.config_get_plugin("short_names") == "": weechat.config_set_plugin("short_names", "on") weechat.hook_signal("hotlist_*", "update_item", "") weechat.hook_signal("key_bind", "update_keydict", "") weechat.hook_signal("key_unbind", "update_keydict", "") weechat.hook_config("plugins.var.python.bufferbar.*", "update_item", "") weechat.bar_item_new("bufferbar", "bufferbar_item_cb", "") weechat.bar_new( "bufferbar", "on", "501", "window", "", "bottom", "horizontal", "vertical", "0", "0", "default", "default", "default", "0", "bufferbar", ) update_keydict() weechat.bar_item_update("bufferbar") # vim:set tabstop=4 softtabstop=4 shiftwidth=4:
if not weechat.config_string_to_boolean(vimode_settings["no_warn"]): check_warnings() # Create bar items and setup hooks. weechat.bar_item_new("mode_indicator", "cb_mode_indicator", "") weechat.bar_item_new("cmd_text", "cb_cmd_text", "") weechat.bar_item_new("vi_buffer", "cb_vi_buffer", "") weechat.bar_item_new("line_numbers", "cb_line_numbers", "") weechat.bar_new( "vi_cmd", "off", "0", "root", "", "bottom", "vertical", "vertical", "0", "0", "default", "default", "default", "0", "cmd_text", ) weechat.bar_new( "vi_line_numbers", "on", "0", "window", "", "left",
weechat.prnt("", "Creating new bar item callback...") cbl_bar_item = weechat.bar_item_new( SCRIPT_NAME, "cbl_build_callback", "") weechat.prnt("", "Creating new bar defaults...") cbl_bar = weechat.bar_new( SCRIPT_NAME, "off", # hidden "0", # priority "root", # type "", # condition "top", # position "columns_horizontal", # filling_top_bottom "vertical", # filling_left_right "0", # size "0", # size_max "default", # color_fg "default", # color_delim "default", # color_bg "on", # separator SCRIPT_NAME) weechat.prnt("", "Setting bar options...") weechat.bar_set( cbl_bar, "filling_top_bottom", "columns_horizontal") weechat.bar_set( cbl_bar,
import weechat weechat.register("Tabs", "jimble", "0.1", "DWTFYWWI ver4.20", "Buffer tabs", "", "") def tabs_item_callback(data, item, window): return "my content | " bar_item = weechat.bar_item_new("bar_item_tabs", "tabs_item_callback", "") bar_tabs = weechat.bar_new("tabs", "off", "100", "root", "", "top", "horrizontal", "vertical", "1", "1", "default", "default", "default", "on", "bar_item_tabs")
color %= weechat.config_integer(weechat.config_get("weechat.look.color_nicks_number")) color = weechat.config_get('weechat.color.chat_nick_color%02d' %(color+1)) color = w.color(weechat.config_string(color)) return '%s%s%s' %(color, nick, weechat.color('reset')) if __name__ == "__main__" and import_ok: if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT_DESC, "", ""): # Set default settings for option, default_value in settings.iteritems(): if not weechat.config_is_set_plugin(option): weechat.config_set_plugin(option, default_value) weechat.hook_command(SCRIPT_COMMAND, "URL bar control", "[list | hide | show | toggle | url URL]", " list: list all URL and show URL bar\n" " hide: hide URL bar\n" " show: show URL bar\n" " toggle: toggle showing of URL bar\n", "list || hide || show || toggle || url %(urlbar_urls)", "urlbar_cmd", "") weechat.hook_completion("urlbar_urls", "list of URLs", "urlbar_completion_urls_cb", "") weechat.bar_item_new("urlbar_urls", "urlbar_item_cb", ""); weechat.bar_new("urlbar", "on", "0", "root", "", "top", "horizontal", "vertical", "0", "0", "default", "default", "default", "0", "urlbar_urls"); weechat.hook_print("", "", "://", 1, "urlbar_print_cb", "")
return w.WEECHAT_RC_OK if w.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT_DESC, 'unload_cb', ''): for option, default_value in settings.iteritems(): if not w.config_is_set_plugin(option): w.config_set_plugin(option, default_value) w.bar_item_new('imap', 'imap_cb', '') w.hook_timer(\ int(w.config_get_plugin('interval'))*1000*60, 0, 0, 'imap_update', '') w.hook_command(SCRIPT_COMMAND, "imap client", "[]", " \n", "", "imap_cmd", "") w.bar_item_new("imap_folders", "imap_folders_item_cb", ""); w.bar_new("imap", "on", "0", "root", "", "right", "horizontal", "vertical", "0", "0", "default", "default", "default", "1", "imap_folders") create_folder_cache()
# create channel buffer chanbuffer = weechat.info_get("irc_buffer", "%s, #multirpg" % (ircserver)) # query bot weechat.command(chanbuffer, "/query multirpg") botbuffer = weechat.current_buffer() # initialise hooks ahook = "" chook = "" shook = "" lhook = "" phook = weechat.hook_print("", "notify_private,nick_multirpg", "", 0, "msgparser", "") # initialise counters acount = 0 ccount = 0 scount = 0 lcount = 0 # setup bar mrpgcounters = weechat.bar_item_new("mrpgcounters", "show_mrpgcounters", "") ctrbar = weechat.bar_new("mrpgbar", "off", "100", "window", "${buffer.full_name} == python.weechat-multirpg", "top", "horizontal", "vertical", "0", "5", "default", "white", "blue", "off", "mrpgcounters") # Issue callbot command to kick us off... callbot()