/mouse enable
/secure passphrase <pass>
/secure set bitlbeepass <pass>
/secure set freenodepass <pass>
/secure set relaypass <pass>
/set irc.server_default.sasl_mechanism PLAIN
/set irc.server_default.sasl_username r3m
/set irc.server_default.nicks r3m
/set irc.server_default.capabilities "account-notify,away-notify,cap-notify,multi-prefix,server-time,znc.in/self-message"
the last line request some IRCv3 capabilities. Capabilities supported by WeeChat are: account-notify, away-notify, cap-notify, extended-join, multi-prefix, server-time, userhost-in-names. See IRCv3 Specifications to learn more about IRCv3 capabilities.
/server add bitlbee localhost -autoconnect
/set irc.server.bitlbee.sasl_password ${sec.data.bitlbeepass}
/server add freenode chat.freenode.net/6697 -ssl -autoconnect
/set irc.server.freenode.sasl_password ${sec.data.freenodepass}
/server add oftc irc.oftc.net/6697 -ssl -autoconnect
/set irc.server.oftc.ssl_cert "%h/ssl/nick.pem"
/set irc.server.oftc.command_delay 5
/server add oragono_testnet testnet.oragono.io/6697 -ssl
/connect -auto
/set weechat.plugin.autoload "*,!guile,!javascript,!lua,!php,!tcl,!perl,!ruby,!fifo,!xfer"
this will load all modules except guile, javascript, lua, php, tcl, perl, ruby, fifo and xfer
/set spell.check.default_dict en,fr
/set spell.check.suggestions 3
/set spell.color.suggestion *green
/spell enable
/trigger addreplace setdict signal irc_channel_opened;irc_pv_opened;irc_server_opened
/trigger set setdict conditions "(${buffer[${tg_signal_data}].full_name} =* irc.undernet.* || (${buffer[${tg_signal_data}].full_name} =~ fr$ && ${buffer[${tg_signal_data}].local_variables.type} == channel)) && ${info:spell_dict,${buffer[${tg_signal_data}].full_name}} !~ ^fr"
/trigger set setdict command "/command -buffer ${buffer[${tg_signal_data}].full_name} * /mute /spell setdict fr,en"
This trigger set spell checker to fr,en when we join a channel with a name ending in 'fr' or when we join any channel or open any query on undernet.
Note: we will add the spell_dict and spell_suggest item to the status bar later on.
/relay sslcertkey
/relay add ssl.irc <port>
/relay add ssl.weechat <port>
/set relay.network.password ${sec.data.relaypass}
If you want a trusted certificate, use let's encrypt! with weechat relay.
/set logger.level.irc 4
/set logger.mask.irc %Y/$server/$channel.%m-%d.log
≥ WeeChat 3.0 for fset.look.auto_refresh
/set fset.color.line_selected_bg1 default
/set fset.color.name_changed 229
/set fset.color.name_changed_selected *229
/set fset.color.type 121
/set fset.color.type_selected *121
/set fset.color.value 31
/set fset.color.value_changed 229
/set fset.color.value_changed_selected *229
/set fset.color.value_selected *31
/set fset.look.auto_refresh "*,!weechat.bar.buflist.size,!plugins.var.buflist_section_*,!plugins.var.python.text_item.conky_*"
/set fset.format.option1 "${if:${selected_line}?${color:*white}>>: } ${marked} ${name} ${type} ${value2}"
/set weechat.bar.fset.conditions "${buffer.full_name} == fset.fset && ${window.win_height} > 7"
/set script.scripts.download_enabled on
/script install autojoin.py buffer_autoset.py autosort.py
autosort.py (require setdict trigger)
/autosort helpers set french_channels_pvs_first ${if:${type}=~(channel|private)&&${info:spell_dict,${buffer.full_name}}!~^fr}
/autosort rules insert 6 ${french_channels_pvs_first}
/trigger addreplace autosort_refresh_on_setdict config "spell.dict.*;spell.check.default_dict" "" "" "/mute /autosort"
sort french channels before other channels. A french channel, in my configuration, is one with a french dictionnary as main dictionnary. This autosort rule sort channels using the main dictionnary. So you also need the trigger setdict which set the dictionnary based on channel's name (channels ending in fr). This also sort french private before other private. A french private, in my configuration, is one with a french dictionnary as main dictionnary. However, the setdict trigger do not set the french dictionnary when a private name end in fr (cause this does not make sense for private). So the only way to set a private as french is to type /spell setdict fr on a private. And if you type this command (on a private or on a channel, for example one not ending in fr) you will need the autosort_refresh_on_setdict trigger to resort the buffers.
/buffer_autoset add core.weechat notify 3
/buffer_autoset add irc.server.* notify 3
/buffer_autoset add relay.relay.list short_name relay
≥ WeeChat 3.1 for ${raw:...}
/exec -nosw -norc -noln -sh -buffer conky conky -C > ~/.conkyrc && conky -t 'Uptime: $uptime_short\nCPU: $cpu%\nRAM: $memperc%\nSwap: $swapperc%\nUp: ${upspeedf eth0} KiB\nDown: ${downspeedf eth0} KiB'
/eval /set weechat.startup.command_after_plugins ${weechat.startup.command_after_plugins}${if:${weechat.startup.command_after_plugins}!=?;}/exec -nosw -norc -noln -buffer conky conky -t 'Uptime: $uptime_short\nCPU: $cpu%\nRAM: $memperc%\nSwap: $swapperc%\nUp: ${raw:${raw:${upspeedf eth0}}} KiB\nDown: ${raw:${raw:${downspeedf eth0}}} KiB'
/buffer_autoset add exec.exec.conky short_name sys
/set weechat.notify.exec.exec.conky none
/buffer_autoset add exec.exec.conky title Conky - the light-weight system monitor
/trigger addreplace conky modifier weechat_print
/trigger set conky conditions "${tg_buffer} == exec.exec.conky && ${tg_tags} =~ ,exec_stdout, && ${tg_message_nocolor} =~ ^[^:]+: *[^ ]"
/trigger set conky regex "/^ \t([^:]+):(.*)/ ${color:_31}${re:1}\t${color:reset}${re:2}/ /.*/${tg_message_nocolor}/my_field /.*/${tg_message_nocolor}/my_value /^([^:]+):.*/${re:1}/my_field / /_/my_field /^[^:]+: */${re:1}/my_value"
#/trigger set conky command "/mute /set plugins.var.python.text_item.conky_${my_field} all \${if:${buffer.num_displayed}==?${my_field} ${color:white}${my_value}}"
This trigger does two things. First (the regex line), it change the look of the ouput to be easier to read and to match the look of the rest of the config. Second (the command line), it create a text_item option for all line and if the conky buffer is not displayed on screen, the items created by text_item will become visibile in the status bar (go to the status bar section to add it to the bar). If you have weechat < 3.0 you should not use the last line because if you open fset at the same time your cpu will reach 100% (see this. If you have weechat ≥ 3.0 it is safe but you must set the option fset.look.auto_refresh value as mine (see the fset section)
Note: you need the conky-cli package on Debian
≥ WeeChat 2.9 for !- operator
/buffer_autoset add exec.exec.weather short_name weather
/set spell.dict.exec.exec.weather fr
/trigger addreplace weather_cmd_weather command "weather;show the weather, using wttr.in, in a new buffer;<location>;;${plugins.var.weather_place}"
/trigger set weather_cmd_weather conditions "${tg_argv_eol1}"
/trigger set weather_cmd_weather regex "/ /+/tg_argv_eol1 /.*/${info:spell_dict,exec.exec.weather}/my_lang /^([^,]+).*/${re:1}/my_lang /^$/en/my_lang"
/trigger set weather_cmd_weather command "/exec -noflush -norc -noln -buffer weather curl -s http://wttr.in/${tg_argv_eol1}?lang=${my_lang}"
/trigger addreplace weather_recreate_cmd config plugins.var.weather_place
/trigger set weather_recreate_cmd regex "/ /+/"
/trigger set weather_recreate_cmd command "/trigger restart weather_cmd_weather"
/set plugins.var.weather_place "montreal|longueuil|quebec|paris"
I found something very similar on the alias wiki page of WeeChat on GitHub. The first trigger allows you to type /weather followed by a location. A new buffer will open and display the weather using wttr.in. The second trigger will call /trigger restart weather_cmd_weather whenever you modify the option plugins.var.weather_place (because the hook must be recreated). The option plugins.var.weather_place is a list of cities for the completion mechanism (when you press tab after /weather ). Put the locations you want in it.
/trigger addreplace weather_set_weather_buffer_title print "exec.exec.weather;exec_stdout;;1"
/trigger set weather_set_weather_buffer_title conditions "${tg_message} =~ ^\w && ${tg_message} !~ wttr\.in|@igor_chubin"
/trigger set weather_set_weather_buffer_title regex "/^[^:]+:(.*)/${re:1}/tg_message_nocolor"
/trigger set weather_set_weather_buffer_title command "/buffer set title ${tg_message};/buffer set localvar_set_extra ${tg_message_nocolor}"
I created this trigger to change the title of the buffer from Executed commands to Weather for City: Montreal, Canada.
/trigger addreplace weather_get_weather_by_shortcut modifier input_text_for_buffer
/trigger set weather_get_weather_by_shortcut conditions "${buffer[${tg_modifier_data}].full_name} == exec.exec.weather && /${weechat.look.command_chars} !- ${cut:1,,${tg_string_nocolor}}"
/trigger set weather_get_weather_by_shortcut regex "==.*==/weather ${re:0}"
This trigger will allow you to enter only the city name (without /weather) in the weather buffer.
≥ WeeChat 2.9 for evaluation of arguments and only return trigger's return code when condition evaluates to true
/bar del buflist_hotlist
/unset plugins.var.buflist_name
/unset plugins.var.real_net_name
/trigger del control_buffers_add_del_buffer
if you plan to upgrade the buflist with my latest change, you can run these four commands. The first one delete the obsolete buflist_hotlist bar (the hotlist is now in the buflist bar). The second one remove an obsolete option. The third one remove an option that has been renamed and the last on delete an obsolete trigger.
/set irc.look.server_buffer independent
Note: show channels and privates buffers under their respective server instead of mixing them all.
/trigger addreplace buflist_tools command "buflist_tools;manage pascalpoitras's custom buflist (https://gist.github.com/pascalpoitras/8406501);resize <buflist_size> <1st_section_size>|? [<2nd_section_size>] || subsection hide|show|toggle|showonly|hideonly <subsection>|-old|-new|-all [<subsection>|-old|-new|-all...] || look enable|disable|toggle <option> [<option>...]; resize: resize the buflist size and the two sections${\n} subsection hide: hide one or more subsection(s)${\n} subsection show: show one or more subsection(s)${\n} subsection toggle: toggle one or more subsection(s)${\n}subsection showonly: hide all subsections except...${\n}subsection hideonly: show all subsections except...${\n} look enable: enable an option that change the behavior of the buflist${\n} look disable: disable an option that change the behavior of the buflist${\n} look toggle: toggle an option that change the behavior of the buflist${\n} buflist_size: new size for the buflist${\n} 1st_section_size: size of first section${\n} 2nd_section_size: size of second section${\n} subsection: a subsection (buffer_number, fold, indent, nick_prefix, buffer_name, lag, filter, relay_count, extra, hotlist)${\n} -old: only the old buflist subsections (buffer_number, indent, buffer_name, filter, relay_count, extra, hotlist)${\n} -new: only the new buflist subsections (fold, nick_prefix, lag)${\n} -all: do action on all subsections${\n} option: an option (indent_tree, real_net_name, show_hidden_buffers)${\n}${\n}The buflist is composed of two sections. The first one is composed of nine subsections. The buffer number, the fold symbol (servers only), the indentation, the nick prefix (channels only), the buffer name, the lag (servers only), the filter (on some buffer like fset, scripts...), the relay count (for the relay buffer) and extra infos about a buffer. The second section is only composed of hotlist. The two sections can be resized independently. If you want to hide a subsection, for example, buffer_number, the bar will not be resized and the section will not be resized too. So you will have more space for the other subsection of the first section. If you want to hide the hotlist, you can use the hide command but then the second subsection will be empty and use space for nothing, space that cant be used by the first section. So if you want to hide the hotlist, you'd be better off using resize and give all the spaces to the first section. TLDR if you're not gonna use the hotlist, do not reserve space for it in the first place.${\n}${\n}Exemples:${\n} Resize the bar to 20 with the size 15 for first section and 5 for second section:${\n} /buflist_tools resize 20 15${\n} Show only the subsections that was available in the old buflist:${\n} /buflist_tools subsection showonly -old;resize 25 || subsection show|hide|toggle|hideonly|showonly buffer_number|fold|indent|nick_prefix|buffer_name|lag|filter|relay_count|extra|hotlist|-old|-new|-all|%* || look enable|disable|toggle indent_tree|real_net_name|show_hidden_buffers|%*"
/trigger set buflist_tools conditions "${tg_argv_eol1} =~ ^resize +[0-9]+ +([0-9]+( +[0-9]+)?|\? +[0-9]+)$ || ${tg_argv_eol1} =~ ^subsection +(hide|show|toggle|showonly|hideonly) +((buffer_number|fold|indent|nick_prefix|buffer_name|lag|filter|relay_count|extra|hotlist|-old|-new|-all)( +|$))+$ || ${tg_argv_eol1} =~ ^look +(enable|disable|toggle) +((indent_tree|real_net_name|show_hidden_buffers)( +|$))+$"
/trigger set buflist_tools regex "/.*/${tg_argv1}/my_command /.*/${if:${tg_argv1}==resize?resize:${tg_argv2}}/my_action /.*/${if:${my_action}==resize?${tg_argv_eol2}}/my_resize_cmds ===^([^ ]+) +([^ ]+)( +([^ ]+))?$===/mute /set plugins.var.buflist_section_1st ${if:${re:2}=~[0-9]+?${re:2}:${calc:${re:1}-${re:4}}};/mute /set plugins.var.buflist_section_2nd ${if:${re:4}=~[0-9]+?${re:4}:${calc:${re:1}-${re:2}}};/bar set buflist size ${re:1}===my_resize_cmds /.*/${if:${my_command}==subsection?${tg_argv_eol3}}/my_subsection_cmds /-all/-new -old/my_subsection_cmds /-old/buffer_number indent buffer_name filter relay_count extra hotlist/my_subsection_cmds /-new/fold nick_prefix lag/my_subsection_cmds /.*/${if:${my_action}=~^(hide|show)only$?buffer_number fold indent nick_prefix buffer_name lag filter relay_count extra hotlist}/my_hide_or_show_everything ===buffer_number|fold|indent|nick_prefix|buffer_name|lag|filter|relay_count|extra|hotlist===/mute /set plugins.var.buflist_subsection_${re:0} ${if:${my_action}==hideonly};===my_hide_or_show_everything ===buffer_number|fold|indent|nick_prefix|buffer_name|lag|filter|relay_count|extra|hotlist===/mute /set plugins.var.buflist_subsection_${re:0} ${if:${my_action}=~^hide?0:${if:${my_action}=~^show?1:\x5c${if:\x5c${plugins.var.buflist_subsection_${re:0}${\x5cx7d}?0:1${\x5cx7d}}};===my_subsection_cmds /.*/${my_hide_or_show_everything}${re:0}/my_subsection_cmds /.*/${if:${my_command}==look?${tg_argv_eol3}}/my_look_cmds ===indent_tree|real_net_name|show_hidden_buffers===/mute /set plugins.var.buflist_look_${re:0} ${if:${my_action}==disable?0:${if:${my_action}==enable?1:${if:${plugins.var.buflist_look_${re:0}}!=?0:1}}};===my_look_cmds /.*/${my_resize_cmds}${my_subsection_cmds}${my_look_cmds}/my_cmds_to_run"
/trigger set buflist_tools command "/command -buffer core.weechat * /eval -s ${my_cmds_to_run}"
This trigger create the command buflist_tools. With this command you can resize the buflist and the sections and show or hide subsections. Type /help buflist_tools for more. You need WeeChat 2.9 for this trigger because the arguments need to be evaulated when the hook is created and previous version of WeeChat don't do that. Do not modify the buflist size and section size without using this command. You can also use alt+wheelup/down in the buflist.
Note on resizing: If the buflist bar is slow to resize, the fset buffer is probably opened. If you have weechat ≥ 3.0 you can fix that by setting the option fset.look.auto_refresh as mine (see the fset section). Otherwise, you will have to either close the fset buffer prior to resizing or be patient.
/buflist_tools resize 20 15
The buflist will be resized to 20. 15 columns for the 1st section and 5 columns for 2nd section
/buflist_tools subsection showonly -old fold
/buflist_tools look enable indent_tree real_net_name
I want to show all the old subsections (so the buflist looks like before) but also add fold (a triangle to expand/collapse channels/privates under their servers). I want to display real network name (not the one used in /server add). Instead of spaces for the indent subsection, I want tree symbols.
/bar add control_buffers window top 1 1 buflist2
/bar set control_buffers priority 499
/bar set control_buffers conditions ${window.number} == ${if:${plugins.var.control_buffers_window}?${plugins.var.control_buffers_window}:2}
Create the control_buffers bar with buflist2 for items and display this bar only on the window with the same number as the number in the option plugins.var.control_buffers_window (or 2 if this options doesn't exist)
/set buflist.format.hotlist_highlight "${color:163}"
/set buflist.format.hotlist_message "${color:229}"
/set buflist.format.hotlist_private "${color:121}"
/set buflist.format.buffer "${if:${bar_item.name}==buflist?${if:${type}==server?${color:,31}:${color:default}}${if:${lengthscr:${format_number}${eval:${plugins.var.buflist_format_fold}}${indent}${format_nick_prefix}${format_name}${format_lag}${eval:${plugins.var.buflist_format_filter}${plugins.var.buflist_format_relay_count}${plugins.var.buflist_format_extra}}} > ${plugins.var.buflist_section_1st}?${cutscr:+${plugins.var.buflist_section_1st},${if:${type}==server?${color:white}:${color:${weechat.color.chat_prefix_more}}}${weechat.look.prefix_align_more},${format_number}${eval:${plugins.var.buflist_format_fold}}${indent}${format_nick_prefix}${format_name}${format_lag}${eval:${plugins.var.buflist_format_filter}${plugins.var.buflist_format_relay_count}${plugins.var.buflist_format_extra}}}:${format_number}${eval:${plugins.var.buflist_format_fold}}${indent}${format_nick_prefix}${format_name}${format_lag}${eval:${plugins.var.buflist_format_filter}${plugins.var.buflist_format_relay_count}${plugins.var.buflist_format_extra}}${repeat:${calc:${plugins.var.buflist_section_1st} - ${lengthscr:${format_number}${eval:${plugins.var.buflist_format_fold}}${indent}${format_nick_prefix}${format_name}${format_lag}${eval:${plugins.var.buflist_format_filter}${plugins.var.buflist_format_relay_count}${plugins.var.buflist_format_extra}}}}, }}${if:${lengthscr:${format_hotlist}} > ${plugins.var.buflist_section_2nd}?${cutscr:+${plugins.var.buflist_section_2nd},${if:${type}==server?${color:white}:${color:${weechat.color.chat_prefix_more}}}${weechat.look.prefix_align_more},${format_hotlist}}:${repeat:${calc:${plugins.var.buflist_section_2nd} - ${lengthscr:${format_hotlist}}}, }${format_hotlist}}:${if:${bar_item.name}==buflist2?${if:${window.buffer}==${buffer}?${color:31}${\ue0be}${color:white,31} ${cutscr:7,${\u2026},${name}} ${color:reset}${color:31}${\ue0bc}:${color:24}${\ue0be}${color:darkgray,24} ${cutscr:7,${\u2026},${name}} ${color:reset}${color:24}${\ue0bc}}:${color_hotlist}${name}}}"
/set buflist.format.buffer_current "${format_buffer}"
/set buflist.format.number "${if:${plugins.var.buflist_subsection_buffer_number}!=?${if:${current_buffer}?${color:*white}${hide:>,${number}} :${if:${type}==server?${color:black}:${color:239}}${number}${if:${number_displayed}?.: }}}"
/set buflist.format.indent "${if:${plugins.var.buflist_subsection_indent}!=?${if:${plugins.var.buflist_look_indent_tree}!=?${color:31}├─: }}"
/set buflist.format.name "${if:${plugins.var.buflist_subsection_buffer_name}!=?${if:${type}==server?${color:white}${if:${plugins.var.buflist_look_real_net_name}!=&&${info:irc_server_isupport_value,${name},NETWORK}?${info:irc_server_isupport_value,${name},NETWORK}:${name}}:${eval:${color_hotlist}}${name}}}"
/set buflist.format.hotlist "${if:${plugins.var.buflist_subsection_hotlist}!=?${if:${plugins.var.buflist_section_2nd}==1? :${hotlist}}}"
/set buflist.format.nick_prefix "${if:${plugins.var.buflist_subsection_nick_prefix}!=&&${buflist.look.nick_prefix}!=?${color:31}${nick_prefix}}"
/set buflist.format.lag "${if:${plugins.var.buflist_subsection_lag}!=?${color:white} [${lag}]}"
/set plugins.var.buflist_format_fold "${if:${plugins.var.buflist_subsection_fold}!=&&${type}==server?${color:black}${if:${buffer.local_variables.fold}==?▼:▲} }"
/set plugins.var.buflist_format_filter "${if:${plugins.var.buflist_subsection_filter}!=&&${buffer.local_variables.filter}!=? ${if:${type}==server?${color:black}:${color:31}}${buffer.local_variables.filter}}"
/set plugins.var.buflist_format_relay_count "${if:${plugins.var.buflist_subsection_relay_count}!=&&${buffer.full_name}==relay.relay.list&&${info:relay_client_count,*,connected}!=? ${color:31}Total${\x3A}${info:relay_client_count,*,connected} IRC${\x3A}${info:relay_client_count,irc,connected} WeeChat${\x3A}${info:relay_client_count,weechat,connected}}"
/set plugins.var.buflist_format_extra "${if:${plugins.var.buflist_subsection_extra}!=&&${buffer.local_variables.extra}!=? ${if:${type}==server?${color:black}:${color:31}}${buffer.local_variables.extra}}"
This was the format options which changed the look of each buflist items
/set buflist.look.use_items 2
Use two items (buflist and buflist2)
/set buflist.look.signals_refresh "irc_server_connected,relay_client_connected,relay_client_disconnected"
Add additionnals signals to refresh the buflist
/set buflist.look.display_conditions "${bar_item.name} == buflist && (${buffer.hidden} == || ${plugins.var.buflist_look_show_hidden_buffers} !=) && (${type} !~ ^(channel|private)$ || ${type} =~ ^(channel|private)$ && ${buffer[${if:${plugin}==irc?${info:irc_buffer,${irc_server.name}}:${info:slack_matrix_server_search,${buffer}}}].local_variables.fold}==) || ${bar_item.name} == buflist2 && ${buffer.local_variables.control_buffer} !="
The conditions to display a buffer in the buflist items.
/trigger addreplace buflist_refresh_options config "weechat.bar.buflist.size*;plugins.var.buflist_*"
/trigger set buflist_refresh_options command "/buflist refresh"
when the buflist is resized, the buflist is refresh. Same for all the plugins.var.buflist_* options
/trigger addreplace control_buffers_change_control_window config "plugins.var.control_buffers_window"
/trigger set control_buffers_change_control_window command "/window refresh"
Refresh window when options plugins.var.control_buffers_window is changed
/trigger addreplace slack_matrix_server_search info slack_matrix_server_search
/trigger set slack_matrix_server_search conditions "${info:python_version} != && ${tg_arguments} != && ${buffer[${tg_arguments}].local_variables.script_name} =~ ^(slack|matrix)$"
/trigger set slack_matrix_server_search regex "/.*/${buffer[${tg_arguments}].local_variables.script_name}/my_script /.*/${buffer[${tg_arguments}].local_variables.plugin}/my_plugin /.*/${buffer[${tg_arguments}].local_variables.server}/my_server /.*/${my_plugin}.${if:${my_script}==matrix?server.}${my_server}/my_server_full_name ==\x5c\x5c==\x5c\x5c==my_server_full_name =='==\'==my_server_full_name /.*/${info:python_eval,print(weechat.buffer_search('==', '${my_server_full_name}'))}/tg_info"
This trigger is needed if you want to be able to expand/collapse slack and matrix servers not just irc
/key bindctxt mouse @item(buflist)>bar(control_buffers):button1* hsignal:toggle_property
/key bindctxt mouse @chat(*)>bar(control_buffers):button1* hsignal:toggle_property
/key bindctxt mouse @bar(control_buffers)>chat(*):button1* /mute /set plugins.var.control_buffers_window ${_window_number2}
/key bindctxt mouse @bar(buflist):alt-wheel* hsignal:buflist_resize
/key bindctxt mouse @item(buflist2):button1* /mute /set plugins.var.control_buffers_previous_active_window ${window.number};/window ${_window_number};hsignal:buflist_mouse;/window ${plugins.var.control_buffers_previous_active_window}
/key bindctxt cursor @item(buflist*):c hsignal:toggle_property;/cursor stop
/key bindctxt cursor @item(buflist*):f hsignal:toggle_property;/cursor stop
/key bindctxt cursor @item(buflist*):r /server raw c:\${${if:${localvar_type}==private?nick:${localvar_type}}}==${localvar_channel};/cursor stop
/key bindctxt cursor @item(buflist*):o /fset c:\${name}=*buffer_autoset.buffer.${full_name}.* ${if:${localvar_type}==server?|| \${name${\x7D}=*${full_name}.*};/cursor stop
/key bindctxt cursor @item(buflist*):C hsignal:toggle_property;/cursor stop
/key bindctxt cursor @item(buflist*):h hsignal:toggle_property;/cursor stop
/key bindctxt cursor @item(buflist):H /buflist_tools look toggle show_hidden_buffers;/cursor stop
/trigger addreplace toggle_bufautoset command "toggle_bufautoset;toggle bufautoset options;<buffer_property> <buffer_fullname>;buffer_property: name of the property${\n}buffer_fullname: name of the buffer${\n}${\n}The buffer_autoset.py script has no toggle mechanism so this command bring this functionality. Also, the script does not reset a property or localvar after deleting them. For example, if you type /buffer_autoset add irc.freenode.#weechat localvar_set_something 1, and then, /buffer_autoset del irc.freenode.#weechat.localvar_set_something, the localvar will still appears in /buffer localvar until you close and reoppen the buffer. This command will remove the localvar and hidden property upon deletion. You should use this command only for properties that take 0 or 1 as value or localvar that take 0 or 1.;;"
/trigger set toggle_bufautoset conditions "${tg_argv2} !="
/trigger set toggle_bufautoset regex "/.*/${tg_argv1}/my_property /.*/${tg_argv2}/my_full_name /.*/${if:${buffer_autoset.buffer.${my_full_name}.${my_property}}!=?del:add}/my_action /.*/${if:${my_action}==add? ${my_full_name} ${my_property} 1: ${my_full_name}.${my_property}}/my_params"
/trigger set toggle_bufautoset command "/mute /buffer_autoset ${my_action} ${my_params};/command -buffer ${my_full_name} * /buffer set ${my_property} ${if:${my_action}==add?1:0}"
/trigger addreplace toggle_property hsignal toggle_property
/trigger set toggle_property regex "/.*/${if:${_chat}!=?${_buffer_full_name}:${full_name}}/my_full_name /.*/${if:${_chat}!=?${_buffer_plugin}:${plugin}}/my_plugin /.*/${if:${_chat}!=?${_buffer_localvar_server}:${localvar_server}}/my_server /.*/${buffer[${pointer}].local_variables.script_name}/my_script_name /.*/${if:${_key}==f?${my_plugin}.${if:${my_plugin}==irc||${my_script_name}==matrix?server.}${my_server}:${re:0}}/my_full_name /.*/${_key}/my_property /^button1.*/localvar_set_control_buffer/my_property /(?-i)^c$/localvar_set_control_buffer/my_property /(?-i)^C$/localvar_set_no_chanmon_like/my_property /(?-i)^f$/localvar_set_fold/my_property /(?-i)^h$/hidden/my_property"
/trigger set toggle_property command "/toggle_bufautoset ${my_property} ${my_full_name}"
/trigger addreplace buflist_resize hsignal buflist_resize
/trigger set buflist_resize conditions "${_key}=~down || ${_key}=~up && (${_bar_item_col} < ${plugins.var.buflist_section_1st} && ${plugins.var.buflist_section_1st} > 1 || ${_bar_item_col} >= ${plugins.var.buflist_section_1st} && ${plugins.var.buflist_section_2nd} > 1)"
/trigger set buflist_resize regex "/.*/${if:${_key}=~up$?-:+}/my_action /.*/${if:${_bar_item_col}<${plugins.var.buflist_section_1st}?1st:2nd}/my_modified_section /.*/${calc:${plugins.var.buflist_section_${my_modified_section}} ${my_action} 1}/my_modified_section_size /.*/${if:${weechat.bar.${_bar_name}.size}!=?${calc:${weechat.bar.${_bar_name}.size} ${my_action} 1}:0}/my_new_bar_size"
/trigger set buflist_resize command "/mute /set plugins.var.buflist_section_${my_modified_section} ${my_modified_section_size};/bar set ${_bar_name} size ${my_new_bar_size}"
/trigger addreplace buflist_fold_symbol_click hsignal 1001|buflist_mouse
/trigger set buflist_fold_symbol_click conditions "${localvar_type} == server && ${plugins.var.buflist_subsection_fold} != && (${plugins.var.buflist_subsection_buffer_number} != && ${_bar_item_col} == ${lengthscr:${buffer[last_gui_buffer].number}.} || ${plugins.var.buflist_subsection_buffer_number} == && ${_bar_item_col} == 0)"
/trigger set buflist_fold_symbol_click command "/toggle_bufautoset localvar_set_fold ${full_name}"
/trigger set buflist_fold_symbol_click return_code "ok_eat"
- This bind allow drag and drop from the buflist item (in bar buflist) to the bar control_buffers. This will add or del the buffer to the control_buffers bar.
- This bind allow drag and drop from a chat area to the control_buffers bar. This will add or del the buffer to the control_buffers bar.
- This bind allows drag and drop from the control_buffers bar to a chat area. This will move the control_buffers bar to another window.
- This bind allows you to resize the buflist bar by pressing alt and using the wheel at the same time.
- This bind will switch to the control window and display the buffer you clicked on and then switch back to the previous window.
- This bind allow you to press 'c' in cursor mode on any buflist items to add or del the buffer to the control_buffers bar.
- This bind will hide the channels and private buffer of a network.
- This bind will show server raw messages for server/channel/private depending on the buffer.
- This bind will show options, in fset, related to the buffer.
- This bind allow you to press 'C' in cursor mode on any buflist items to add or remove buffer in chanmon
- This bind allow you to press 'h' in cursor mode on any buflist items to hide a buffer
- This bind allow you to press 'H' in cursor mode on the buflist items to toggle the option show_hidden_buffers (when this option is set, the hidden buffers are displayed in the buflist, this is useful to unhide them with 'h')
The last trigger need WeeChat 2.9 for this: only return trigger's return code when condition evaluates to true
/set plugins.var.control_buffers_window 2
/buffer_autoset add core.weechat localvar_set_control_buffer 1
/buffer_autoset add core.highmon localvar_set_control_buffer 1
/buffer_autoset add core.chanmon localvar_set_control_buffer 1
/buffer_autoset add core.newsmon localvar_set_control_buffer 1
set window number 2 as the control window (the window with the control_buffers bar). Add core.weechat, core.highmon, core.chanmon and core.newsmon in the control_buffers bar.
/bar del title
/bar add titlenosep window top 1 0 [#window_number],buffer_title
/bar set titlenosep priority 500
/bar set titlenosep conditions ${window.number} == ${if:${plugins.var.control_buffers_window}?${plugins.var.control_buffers_window}:2}
/bar set titlenosep color_fg white
/bar set titlenosep color_bg 31
/bar set titlenosep color_bg_inactive 31
A window bar to display the title, with no separator. Used on the window with the number corresponding to the option plugins.var.control_buffers_window
/bar add titlesep window top 1 1 [#window_number],buffer_title
/bar set titlesep priority 500
/bar set titlesep conditions ${window.number} != ${if:${plugins.var.control_buffers_window}?${plugins.var.control_buffers_window}:2}
/bar set titlesep color_fg white
/bar set titlesep color_bg 31
/bar set titlesep color_bg_inactive 31
A window bar to display the title with a separator. All window except the one with a number corresponding to the option plugins.var.control_buffers_window.
/bar set status items [time],[buffer_last_number],[buffer_plugin],buffer_number+:+buffer_name+(buffer_modes)+{buffer_nicklist_count}+buffer_zoom+buffer_filter,scroll,[lag],[spell_dict],[spell_suggest],completion
/bar set status conditions ${window.number} == 1
/bar set status color_fg 31
/bar set status color_bg 234
/bar set status color_bg_inactive 234
/bar set status separator 1
#/eval /set weechat.bar.status.items ${weechat.bar.status.items},conky_CPU,conky_RAM,conky_Swap,conky_Up,conky_Down
Uncomment the last line if you want to show system info using conky when the conky buffer is not displayed. You will need the conky trigger and the script text_item.py
/bar set input conditions ${window.number} == 1
/bar set nicklist color_fg 229
/bar set nicklist separator 1
/bar set nicklist conditions ${nicklist} && ${window.number} == 1 && ${buffer.full_name} !~ ^irc.freenode.(#newsbin|##news)$
/bar set nicklist size_max 14
/bar set nicklist size 14
Note: I changed the conditions to display the nicklist only on buffer of type channels ${nicklist} and on the window number 1, which is my chat window (2 being my highlight window and 3 my conky window). In my case, I could remove ${window.numer} == 1 because the highmon and exec buffer (conky) are not of type channels so ${nicklist} is enough.
≥ WeeChat 3.1 for tg_trigger_name and eval_cond
[trigger] /chanmon_tools set <option> <value>
section add [-fg|-bg|-samesep|-len|-condition <value>] <section> <position> <content>
section del <section> [<section>...]
section set <section> <section_opt> <value>
section list|clear
list push|remove|replace|unshift <section> [<section>...]
list pop|shift|clear
this is the command syntax
/buffer add chanmon
/eval /set weechat.startup.command_after_plugins ${weechat.startup.command_after_plugins}${if:${weechat.startup.command_after_plugins}!=?;}/buffer add chanmon
/buffer_autoset add core.chanmon notify none
/buffer_autoset add core.chanmon highlight_words -
/buffer_autoset add core.chanmon title Channels Monitor
/buffer_autoset add core.chanmon time_for_each_line 0
/buffer_autoset add core.chanmon localvar_set_no_chanmon_like 1
/eval /buffer_autoset add ${if:${plugins.var.news_buffer_full_name}!=?${plugins.var.news_buffer_full_name}:irc.freenode.##news} localvar_set_no_chanmon_like 1
/trigger addreplace chanmon_tools command "chanmon_tools;manage the powerline bar for ${cut:7,,${tg_trigger_name}};set <option> <value> || section add [-fg|-bg|-samesep|-len|-condition <value>] <section> <position> <content> || section del <section> [<section>...] || section set <section> <section_opt> <value> || section list|clear || list push|remove|replace|unshift <section> [<section>...] || list pop|shift|clear; set: set a general option${\n} section add: add a new section${\n} section del: delete one or more sections${\n} section set: change a section option${\n} section list: list all options from all sections${\n}section clear: delete all sections${\n} list pop: remove the last section in the list${\n} list push: put one or more sections at the end of the list${\n} list shift: remove the first section in the list${\n} list clear: clear the list${\n} list remove: remove one or more sections in the list${\n} list unshift: put one or more sections at the beginning of the list${\n} list replace: replace the list${\n} -fg: set the foreground color${\n} -bg: set the background color${\n} -samesep: foreground color for the separator used when two consecutives sections have the same background color${\n} -condition: condition to display the section${\n} -len: set the length (0 for unlimited)${\n} section: name of the section${\n} position: 'start' to insert the section at the start of the list, 'end' to add the section at the end of the list${\n} content: content to display in the section${\n} option: name of option: fg, bg, samesep, len, condition${if:${cut:7,,${tg_trigger_name}}==newsmon?, keep_url, keep_date}.${\n} section_opt: name of option: fg, bg, samesep, len, condition, content.${\n} value: new value for the option${\n}${\n}This command manages the look of the powerline bar displayed in front of each message in the ${cut:7,,${tg_trigger_name}} buffer${if:${cut:7,,${tg_trigger_name}}==newsmon? (and also let you show or hide the url and date in the message itself)}. The section subcommand manages the sections while the list subcommand manages the list of the displayed sections. A section may exist without being in the list. In this case the section will not be displayed. But even if a section is in the list, the section will appears only if the condition of the section gives true. This condition is evaluated on each new message, so depending on the message, the section will or will not be displayed. All options are evaluated. You can't use space or start the value with a - when using section add. To overcome this, use section set instead. In addition to all the variables from the print trigger, the following variables are available for you to use in any option: ${if:${cut:7,,${tg_trigger_name}}==newsmon?my_site_and_sections, my_site, my_title, my_date, my_url, my_url_encode, }my_date_only, my_time_only and my_channel_no_prefix.${\n}${\n}Exemples:${\n} Add three sections and display them:${\n} /${tg_trigger_name} section add -fg white -bg 24 -len 3 serv end \${server}${\n} /${tg_trigger_name} section add -fg white -bg 24 -len 4 chan end \${my_channel_no_prefix}${\n} /${tg_trigger_name} section add -fg white -bg 24 -len 5 nick end \${tg_tag_nick}${\n} ${color:white,24} fr… ${color:black}${color:white} wee… ${color:black}${color:white} r3m ${color:24,default};set fg|bg|samesep|len|condition${if:${cut:7,,${tg_trigger_name}}==newsmon?|keep_url|keep_date} || section add|del|set|list|clear || list push|remove|replace|unshift|pop|shift|clear"
/trigger set chanmon_tools conditions "${info:version_number} >= 50397184 && ${tg_argv_eol1} =~ ^set +[[:alnum:]_]+ . || ${tg_argv_eol1} =~ ^section +add +(-(fg|bg|samesep|len|condition) +[^- ][^ ]* +)*[[:alnum:]_]+ +(start|end|none) +. || ${tg_argv_eol1} =~ ^section +set +[[:alnum:]_]+ (fg|bg|samesep|len|condition|content) . || ${tg_argv_eol1} =~ ^section +(list|clear)$ || ${tg_argv_eol1} =~ ^section +del +[[:alnum:]_ ]+$ ||${tg_argv_eol1} =~ ^list +(shift|pop|clear)$ || ${tg_argv_eol1} =~ ^list +(unshift|push|replace|remove) +[[:alnum:]_ ]+$"
/trigger set chanmon_tools regex "/.*/${tg_trigger_name}/my_buffer /_tools$//my_buffer /.*/${tg_argv1}${if:${tg_argv1}!=set? ${tg_argv2}}/my_command /;/\x5c;/tg_argv_eol3 /;/\x5c;/tg_argv_eol5 /\$\{/${\x5cx5c}${re:0}/tg_argv_eol3 /\$\{/${\x5cx5c}${re:0}/tg_argv_eol5 /.*/${if:${my_command}==section add&&${cut:1,,${tg_argv3}}== -?${tg_argv_eol3}}/my_opt_args /( [^- ][^ ]* +)[[:alnum:]_]+ .*/${re:1}/my_opt_args /.*/${tg_argv_eol3}/my_required_args /^-[^ ]+ +[^ ]+ +//my_required_args /.*/${my_required_args}/my_position /^[^ ]+ +([^ ]+).*/${re:1}/my_position /.*/${my_required_args}/my_content /^[^ ]+ +[^ ]+ +(.*)/${re:1}/my_content /.*/${if:${my_command}==section add?${if:${my_position}==start?unshift:${if:${my_position}==end?push}}:${if:${my_command}==section del?remove:${if:${my_command}==section clear?clear:${if:${tg_argv1}==list?${tg_argv2}}}}}/my_list_action /.*/${my_required_args}/my_sections /^([^ ]+).*/${if:${my_command}=~^section (add|set)$?${re:1}:${re:0}}/my_sections /.+/,${re:0},/my_sections / +/,/my_sections /.*/${plugins.var.${my_buffer}.list}/my_list /[^,]+/${if:${re:0}=~^[[:alnum:]_]+$?${re:0}}/my_list /[^,]+(.*)/${if:${my_list_action}==shift?${re:1}:${re:0}}/my_list /(^|,)[^,]+,*$/${if:${my_list_action}==pop?:${re:0}}/my_list /.*/${if:${my_list_action}==unshift?${my_sections}}${re:0}/my_list /.*/${re:0}${if:${my_list_action}==push?${my_sections}}/my_list /[^,]+/${if:${my_list_action}==remove&&${my_sections}=-,${re:0},?:${re:0}}/my_list /.*/${if:${my_list_action}==replace?${my_sections}:${re:0}}/my_list /.*/${if:${my_list_action}==clear?:${re:0}}/my_list /,+/,/my_list /^,|,$//my_list /^,|,$//my_sections ===$===${if:${my_command}==set?/mute /set plugins.var.${my_buffer}.general.${tg_argv2} ${tg_argv_eol3};}===my_cmds_to_run ===$===${if:${my_command}==section set?/mute /set plugins.var.${my_buffer}.section.${tg_argv3}.${tg_argv4} ${tg_argv_eol5};}===my_cmds_to_run ===-([^ ]+) +([^ ]+) +===/mute /set plugins.var.${my_buffer}.section.${my_sections}.${re:1} ${re:2};===my_opt_args ===$===${if:${my_command}==section add?${my_opt_args};/mute /set plugins.var.${my_buffer}.section.${my_sections}.content ${my_content};}===my_cmds_to_run ===$===${if:${my_command}==section list?/mute /set plugins.var.${my_buffer}.section.*;}===my_cmds_to_run /.*/${my_sections}/my_delete_sections ===([^,]+)(,|$)===/mute /unset -mask plugins.var.${my_buffer}.section.${re:1}.*;===my_delete_sections ===$===${if:${my_command}==section del?${my_delete_sections}}===my_cmds_to_run ===$===${if:${my_command}==section clear?/mute /unset -mask plugins.var.${my_buffer}.section.*;}===my_cmds_to_run ===$===${if:${my_list_action}!=?/mute /set plugins.var.${my_buffer}.list \"${my_list}\";}===my_cmds_to_run"
/trigger set chanmon_tools command "/command -buffer core.weechat * /eval -s ${my_cmds_to_run}"
/trigger addreplace chanmon print "*;irc_privmsg,matrix_message"
/trigger set chanmon conditions "${info:version_number} >= 50397184 && ${buffer.local_variables.type} == channel && ${buffer.local_variables.no_chanmon_like} =="
/trigger set chanmon regex "/.*/${tg_date}/my_date_only /(.*) .*/${re:1}/my_date_only /.*/${tg_date}/my_time_only /.* (.*)/${re:1}/my_time_only /.*/${channel}/my_channel_no_prefix /^.(.)(.*)/${if:${re:1}==#&&${info:irc_server_isupport_value,${server},NETWORK}==freenode?:${re:1}}${re:2}/my_channel_no_prefix /.*/plugins.var.${tg_trigger_name}.general/my_general_prefix /.*/${if:${length:${${my_general_prefix}.bg}}!=?${${my_general_prefix}.bg}:red}/my_default_bg /.*/default/my_end.bg /.*/${plugins.var.${tg_trigger_name}.list}/my_list /[^,]+/${if:${re:0}=~^[[:alnum:]_]+$?${re:0}}/my_list /[^,]+/plugins.var.${tg_trigger_name}.section.${re:0}/my_list /[^,]+/${if:${eval_cond:${if:${length:${${re:0}.condition}}!=?${${re:0}.condition}:${if:${length:${${my_general_prefix}.condition}}!=?${${my_general_prefix}.condition}:1}}}!=?${re:0}}/my_list /[^,]+/${re:0},${re:0}/my_list /^,*[^,]+(.*)/${re:1}/my_list /.*[^,].*/${re:0},my_end/my_list /[^,]+/${if:${length:${${re:0}.fg}}!=?${re:0}.fg:${my_general_prefix}.fg},${if:${length:${${re:0}.bg}}!=?${re:0}.bg:my_default_bg},${if:${length:${${re:0}.samesep}}!=?${re:0}.samesep:${my_general_prefix}.samesep},${if:${length:${${re:0}.len}}!=?${re:0}.len:${my_general_prefix}.len},${re:0}.content/my_list /,+/,/my_list /^,|,$//my_list /([^,]+),([^,]+),([^,]+),([^,]+),([^,]+)()()()()(),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+)(,|$)/${color:${eval:${${re:1}},${eval:${${re:2}}}}} ${if:${eval:${${re:4}}}=~^[0-9]+$&&${eval:${${re:4}}}!=?${if:${lengthscr:${eval:${${re:5}}}}>=${eval:${${re:4}}}?${cutscr:+${eval:${${re:4}}},…,${eval:${${re:5}}}}:${eval:${${re:5}}}${repeat:${calc:${eval:${${re:4}}}-${lengthscr:${eval:${${re:5}}}}}, }}:${eval:${${re:5}}}}${color:${eval:${${re:1}},${eval:${${re:2}}}}} ${if:${color:${eval:${${re:2}}}}==${color:${eval:${${re:12}}}}?${color:${eval:${${re:3}}}}:${color:${eval:${${re:2}},${eval:${${re:12}}}}}}${color:reset}/my_list /.+/${re:0} /my_list"
/trigger set chanmon command "/print -newbuffer ${tg_trigger_name} -tags ${tg_tags} \t${my_list}${tg_message}"
/chanmon_tools set fg white
/chanmon_tools set bg 31
/chanmon_tools set samesep 24
/chanmon_tools set condition ${tg_highlight}==
/chanmon_tools section add -bg 24 -len 5 date end ${color:underline}${cut:5,,${my_time_only}}
/chanmon_tools section add -len 2 serv end ${color:underline}${server}
/chanmon_tools section add -len 4 chan end ${color:underline}${my_channel_no_prefix}
/chanmon_tools section add -len 5 nick end ${color:underline}${if:${tg_tags}=~,irc_action,? *:${tg_tag_nick}}
/chanmon_tools section add -bg 52 -len 5 -condition ${tg_highlight}!= date_hl end ${color:underline}${cut:5,,${my_time_only}}
/chanmon_tools section add -bg 88 -samesep 52 -len 2 -condition ${tg_highlight}!= serv_hl end ${color:underline}${server}
/chanmon_tools section add -bg 88 -samesep 52 -len 4 -condition ${tg_highlight}!= chan_hl end ${color:underline}${my_channel_no_prefix}
/chanmon_tools section add -bg 88 -len 5 -condition ${tg_highlight}!= nick_hl end ${color:underline}${if:${tg_tags}=~,irc_action,? *:${tg_tag_nick}}
Note: there is a lot of evaluation in the chanmon trigger (there is also a lot in chanmon_tools trigger but this trigger is only executed when you run the /chanmon_tools command). So if you are on many channels or channels are very active this can be a bit slow.
The first trigger create the chanmon_tools command. The second trigger send all irc_privmsg or matrix_message from all channels to the core.chanmon buffer. Then we create the different section for our powerline bar. Don't use default for the bg of any section, the bar will be ugly, I could use color:reverse to overcome that but weechat-android and glowing-bear doesnt support reverse and i want the output to be good in those relay client too.
≥ WeeChat 3.1 for tg_trigger_name and eval_cond
[trigger] /highmon_tools set <option> <value>
section add [-fg|-bg|-samesep|-len|-condition <value>] <section> <position> <content>
section del <section> [<section>...]
section set <section> <section_opt> <value>
section list|clear
list push|remove|replace|unshift <section> [<section>...]
list pop|shift|clear
this is the command syntax
/buffer add highmon
/eval /set weechat.startup.command_after_plugins ${weechat.startup.command_after_plugins}${if:${weechat.startup.command_after_plugins}!=?;}/buffer add highmon
/buffer_autoset add core.highmon notify none
/buffer_autoset add core.highmon highlight_words -
/buffer_autoset add core.highmon title Highlight Monitor
/buffer_autoset add core.highmon time_for_each_line 0
/trigger addreplace highmon_tools command "highmon_tools;manage the powerline bar for ${cut:7,,${tg_trigger_name}};set <option> <value> || section add [-fg|-bg|-samesep|-len|-condition <value>] <section> <position> <content> || section del <section> [<section>...] || section set <section> <section_opt> <value> || section list|clear || list push|remove|replace|unshift <section> [<section>...] || list pop|shift|clear; set: set a general option${\n} section add: add a new section${\n} section del: delete one or more sections${\n} section set: change a section option${\n} section list: list all options from all sections${\n}section clear: delete all sections${\n} list pop: remove the last section in the list${\n} list push: put one or more sections at the end of the list${\n} list shift: remove the first section in the list${\n} list clear: clear the list${\n} list remove: remove one or more sections in the list${\n} list unshift: put one or more sections at the beginning of the list${\n} list replace: replace the list${\n} -fg: set the foreground color${\n} -bg: set the background color${\n} -samesep: foreground color for the separator used when two consecutives sections have the same background color${\n} -condition: condition to display the section${\n} -len: set the length (0 for unlimited)${\n} section: name of the section${\n} position: 'start' to insert the section at the start of the list, 'end' to add the section at the end of the list${\n} content: content to display in the section${\n} option: name of option: fg, bg, samesep, len, condition${if:${cut:7,,${tg_trigger_name}}==newsmon?, keep_url, keep_date}.${\n} section_opt: name of option: fg, bg, samesep, len, condition, content.${\n} value: new value for the option${\n}${\n}This command manages the look of the powerline bar displayed in front of each message in the ${cut:7,,${tg_trigger_name}} buffer${if:${cut:7,,${tg_trigger_name}}==newsmon? (and also let you show or hide the url and date in the message itself)}. The section subcommand manages the sections while the list subcommand manages the list of the displayed sections. A section may exist without being in the list. In this case the section will not be displayed. But even if a section is in the list, the section will appears only if the condition of the section gives true. This condition is evaluated on each new message, so depending on the message, the section will or will not be displayed. All options are evaluated. You can't use space or start the value with a - when using section add. To overcome this, use section set instead. In addition to all the variables from the print trigger, the following variables are available for you to use in any option: ${if:${cut:7,,${tg_trigger_name}}==newsmon?my_site_and_sections, my_site, my_title, my_date, my_url, my_url_encode, }my_date_only, my_time_only and my_channel_no_prefix.${\n}${\n}Exemples:${\n} Add three sections and display them:${\n} /${tg_trigger_name} section add -fg white -bg 24 -len 3 serv end \${server}${\n} /${tg_trigger_name} section add -fg white -bg 24 -len 4 chan end \${my_channel_no_prefix}${\n} /${tg_trigger_name} section add -fg white -bg 24 -len 5 nick end \${tg_tag_nick}${\n} ${color:white,24} fr… ${color:black}${color:white} wee… ${color:black}${color:white} r3m ${color:24,default};set fg|bg|samesep|len|condition${if:${cut:7,,${tg_trigger_name}}==newsmon?|keep_url|keep_date} || section add|del|set|list|clear || list push|remove|replace|unshift|pop|shift|clear"
/trigger set highmon_tools conditions "${info:version_number} >= 50397184 && ${tg_argv_eol1} =~ ^set +[[:alnum:]_]+ . || ${tg_argv_eol1} =~ ^section +add +(-(fg|bg|samesep|len|condition) +[^- ][^ ]* +)*[[:alnum:]_]+ +(start|end|none) +. || ${tg_argv_eol1} =~ ^section +set +[[:alnum:]_]+ (fg|bg|samesep|len|condition|content) . || ${tg_argv_eol1} =~ ^section +(list|clear)$ || ${tg_argv_eol1} =~ ^section +del +[[:alnum:]_ ]+$ ||${tg_argv_eol1} =~ ^list +(shift|pop|clear)$ || ${tg_argv_eol1} =~ ^list +(unshift|push|replace|remove) +[[:alnum:]_ ]+$"
/trigger set highmon_tools regex "/.*/${tg_trigger_name}/my_buffer /_tools$//my_buffer /.*/${tg_argv1}${if:${tg_argv1}!=set? ${tg_argv2}}/my_command /;/\x5c;/tg_argv_eol3 /;/\x5c;/tg_argv_eol5 /\$\{/${\x5cx5c}${re:0}/tg_argv_eol3 /\$\{/${\x5cx5c}${re:0}/tg_argv_eol5 /.*/${if:${my_command}==section add&&${cut:1,,${tg_argv3}}== -?${tg_argv_eol3}}/my_opt_args /( [^- ][^ ]* +)[[:alnum:]_]+ .*/${re:1}/my_opt_args /.*/${tg_argv_eol3}/my_required_args /^-[^ ]+ +[^ ]+ +//my_required_args /.*/${my_required_args}/my_position /^[^ ]+ +([^ ]+).*/${re:1}/my_position /.*/${my_required_args}/my_content /^[^ ]+ +[^ ]+ +(.*)/${re:1}/my_content /.*/${if:${my_command}==section add?${if:${my_position}==start?unshift:${if:${my_position}==end?push}}:${if:${my_command}==section del?remove:${if:${my_command}==section clear?clear:${if:${tg_argv1}==list?${tg_argv2}}}}}/my_list_action /.*/${my_required_args}/my_sections /^([^ ]+).*/${if:${my_command}=~^section (add|set)$?${re:1}:${re:0}}/my_sections /.+/,${re:0},/my_sections / +/,/my_sections /.*/${plugins.var.${my_buffer}.list}/my_list /[^,]+/${if:${re:0}=~^[[:alnum:]_]+$?${re:0}}/my_list /[^,]+(.*)/${if:${my_list_action}==shift?${re:1}:${re:0}}/my_list /(^|,)[^,]+,*$/${if:${my_list_action}==pop?:${re:0}}/my_list /.*/${if:${my_list_action}==unshift?${my_sections}}${re:0}/my_list /.*/${re:0}${if:${my_list_action}==push?${my_sections}}/my_list /[^,]+/${if:${my_list_action}==remove&&${my_sections}=-,${re:0},?:${re:0}}/my_list /.*/${if:${my_list_action}==replace?${my_sections}:${re:0}}/my_list /.*/${if:${my_list_action}==clear?:${re:0}}/my_list /,+/,/my_list /^,|,$//my_list /^,|,$//my_sections ===$===${if:${my_command}==set?/mute /set plugins.var.${my_buffer}.general.${tg_argv2} ${tg_argv_eol3};}===my_cmds_to_run ===$===${if:${my_command}==section set?/mute /set plugins.var.${my_buffer}.section.${tg_argv3}.${tg_argv4} ${tg_argv_eol5};}===my_cmds_to_run ===-([^ ]+) +([^ ]+) +===/mute /set plugins.var.${my_buffer}.section.${my_sections}.${re:1} ${re:2};===my_opt_args ===$===${if:${my_command}==section add?${my_opt_args};/mute /set plugins.var.${my_buffer}.section.${my_sections}.content ${my_content};}===my_cmds_to_run ===$===${if:${my_command}==section list?/mute /set plugins.var.${my_buffer}.section.*;}===my_cmds_to_run /.*/${my_sections}/my_delete_sections ===([^,]+)(,|$)===/mute /unset -mask plugins.var.${my_buffer}.section.${re:1}.*;===my_delete_sections ===$===${if:${my_command}==section del?${my_delete_sections}}===my_cmds_to_run ===$===${if:${my_command}==section clear?/mute /unset -mask plugins.var.${my_buffer}.section.*;}===my_cmds_to_run ===$===${if:${my_list_action}!=?/mute /set plugins.var.${my_buffer}.list \"${my_list}\";}===my_cmds_to_run"
/trigger set highmon_tools command "/command -buffer core.weechat * /eval -s ${my_cmds_to_run}"
/trigger addreplace highmon print "*;irc_privmsg,matrix_message"
/trigger set highmon conditions "${info:version_number} >= 50397184 && ${tg_highlight} == 1 && ${tg_displayed} == 1 && ${buffer.local_variables.type} == channel"
/trigger set highmon regex "/.*/${tg_date}/my_date_only /(.*) .*/${re:1}/my_date_only /.*/${tg_date}/my_time_only /.* (.*)/${re:1}/my_time_only /.*/${channel}/my_channel_no_prefix /^.(.)(.*)/${if:${re:1}==#&&${info:irc_server_isupport_value,${server},NETWORK}==freenode?:${re:1}}${re:2}/my_channel_no_prefix /.*/plugins.var.${tg_trigger_name}.general/my_general_prefix /.*/${if:${length:${${my_general_prefix}.bg}}!=?${${my_general_prefix}.bg}:red}/my_default_bg /.*/default/my_end.bg /.*/${plugins.var.${tg_trigger_name}.list}/my_list /[^,]+/${if:${re:0}=~^[[:alnum:]_]+$?${re:0}}/my_list /[^,]+/plugins.var.${tg_trigger_name}.section.${re:0}/my_list /[^,]+/${if:${eval_cond:${if:${length:${${re:0}.condition}}!=?${${re:0}.condition}:${if:${length:${${my_general_prefix}.condition}}!=?${${my_general_prefix}.condition}:1}}}!=?${re:0}}/my_list /[^,]+/${re:0},${re:0}/my_list /^,*[^,]+(.*)/${re:1}/my_list /.*[^,].*/${re:0},my_end/my_list /[^,]+/${if:${length:${${re:0}.fg}}!=?${re:0}.fg:${my_general_prefix}.fg},${if:${length:${${re:0}.bg}}!=?${re:0}.bg:my_default_bg},${if:${length:${${re:0}.samesep}}!=?${re:0}.samesep:${my_general_prefix}.samesep},${if:${length:${${re:0}.len}}!=?${re:0}.len:${my_general_prefix}.len},${re:0}.content/my_list /,+/,/my_list /^,|,$//my_list /([^,]+),([^,]+),([^,]+),([^,]+),([^,]+)()()()()(),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+)(,|$)/${color:${eval:${${re:1}},${eval:${${re:2}}}}} ${if:${eval:${${re:4}}}=~^[0-9]+$&&${eval:${${re:4}}}!=?${if:${lengthscr:${eval:${${re:5}}}}>=${eval:${${re:4}}}?${cutscr:+${eval:${${re:4}}},…,${eval:${${re:5}}}}:${eval:${${re:5}}}${repeat:${calc:${eval:${${re:4}}}-${lengthscr:${eval:${${re:5}}}}}, }}:${eval:${${re:5}}}}${color:${eval:${${re:1}},${eval:${${re:2}}}}} ${if:${color:${eval:${${re:2}}}}==${color:${eval:${${re:12}}}}?${color:${eval:${${re:3}}}}:${color:${eval:${${re:2}},${eval:${${re:12}}}}}}${color:reset}/my_list /.+/${re:0} /my_list"
/trigger set highmon command "/print -newbuffer ${tg_trigger_name} -tags ${tg_tags} \t${my_list}${tg_message}"
/highmon_tools set fg white
/highmon_tools set bg 88
/highmon_tools set samesep 52
/highmon_tools section add -bg 52 -len 5 date start ${color:underline}${cut:5,,${my_time_only}}
/highmon_tools section add -len 2 serv end ${color:underline}${server}
/highmon_tools section add -len 4 chan end ${color:underline}${my_channel_no_prefix}
/highmon_tools section add -len 5 nick end ${color:underline}${if:${tg_tags}=~,irc_action,? *:${tg_tag_nick}}
The first trigger create the highmon_tools command. The second trigger send all channel highlights to the core.highmon buffer. Then we create the different section for our powerline bar. Don't use default for the bg of any section, the bar will be ugly, I could use color:reverse to overcome that but weechat-android and glowing-bear doesnt support reverse and i want the output to be good in those relay client too.
≥ WeeChat 3.1 for tg_trigger_name and eval_cond
[trigger] /newsmon_tools set <option> <value>
section add [-fg|-bg|-samesep|-len|-condition <value>] <section> <position> <content>
section del <section> [<section>...]
section set <section> <section_opt> <value>
section list|clear
list push|remove|replace|unshift <section> [<section>...]
list pop|shift|clear
this is the command syntax
/trigger del news_transform
/filter del news
the commands above delete the obsolete news_transform trigger and news filter
/buffer add newsmon
/eval /set weechat.startup.command_after_plugins ${weechat.startup.command_after_plugins}${if:${weechat.startup.command_after_plugins}!=?;}/buffer add newsmon
/buffer_autoset add core.newsmon notify none
/buffer_autoset add core.newsmon highlight_words -
/buffer_autoset add core.newsmon title News Monitor
/buffer_autoset add core.newsmon time_for_each_line 0
/eval /buffer_autoset add ${if:${plugins.var.news_buffer_full_name}!=?${plugins.var.news_buffer_full_name}:irc.freenode.##news} hidden 1
/eval /filter addreplace news_interest core.newsmon,${if:${plugins.var.news_buffer_full_name}!=?${plugins.var.news_buffer_full_name}:irc.freenode.##news} irc_privmsg+nick_newsly*,matrix_message+nick_newsly* !^(\s|\[)(Reddit [-] /r/netsec|Wired|freenode|EFF Updates|erry's blog|techdirt|TorrentFreak|Science Daily|Hacker News|CNET|phoronix|Ars Technica|The Intercept|france24|Radio-Canada Nouvelles|Canoe|Huffington Post [-] Weird News|Journal du hacker|Futura Sciences)( \-| | |\])
/trigger addreplace newsmon_tools command "newsmon_tools;manage the powerline bar for ${cut:7,,${tg_trigger_name}};set <option> <value> || section add [-fg|-bg|-samesep|-len|-condition <value>] <section> <position> <content> || section del <section> [<section>...] || section set <section> <section_opt> <value> || section list|clear || list push|remove|replace|unshift <section> [<section>...] || list pop|shift|clear; set: set a general option${\n} section add: add a new section${\n} section del: delete one or more sections${\n} section set: change a section option${\n} section list: list all options from all sections${\n}section clear: delete all sections${\n} list pop: remove the last section in the list${\n} list push: put one or more sections at the end of the list${\n} list shift: remove the first section in the list${\n} list clear: clear the list${\n} list remove: remove one or more sections in the list${\n} list unshift: put one or more sections at the beginning of the list${\n} list replace: replace the list${\n} -fg: set the foreground color${\n} -bg: set the background color${\n} -samesep: foreground color for the separator used when two consecutives sections have the same background color${\n} -condition: condition to display the section${\n} -len: set the length (0 for unlimited)${\n} section: name of the section${\n} position: 'start' to insert the section at the start of the list, 'end' to add the section at the end of the list${\n} content: content to display in the section${\n} option: name of option: fg, bg, samesep, len, condition${if:${cut:7,,${tg_trigger_name}}==newsmon?, keep_url, keep_date}.${\n} section_opt: name of option: fg, bg, samesep, len, condition, content.${\n} value: new value for the option${\n}${\n}This command manages the look of the powerline bar displayed in front of each message in the ${cut:7,,${tg_trigger_name}} buffer${if:${cut:7,,${tg_trigger_name}}==newsmon? (and also let you show or hide the url and date in the message itself)}. The section subcommand manages the sections while the list subcommand manages the list of the displayed sections. A section may exist without being in the list. In this case the section will not be displayed. But even if a section is in the list, the section will appears only if the condition of the section gives true. This condition is evaluated on each new message, so depending on the message, the section will or will not be displayed. All options are evaluated. You can't use space or start the value with a - when using section add. To overcome this, use section set instead. In addition to all the variables from the print trigger, the following variables are available for you to use in any option: ${if:${cut:7,,${tg_trigger_name}}==newsmon?my_site_and_sections, my_site, my_title, my_date, my_url, my_url_encode, }my_date_only, my_time_only and my_channel_no_prefix.${\n}${\n}Exemples:${\n} Add three sections and display them:${\n} /${tg_trigger_name} section add -fg white -bg 24 -len 3 serv end \${server}${\n} /${tg_trigger_name} section add -fg white -bg 24 -len 4 chan end \${my_channel_no_prefix}${\n} /${tg_trigger_name} section add -fg white -bg 24 -len 5 nick end \${tg_tag_nick}${\n} ${color:white,24} fr… ${color:black}${color:white} wee… ${color:black}${color:white} r3m ${color:24,default};set fg|bg|samesep|len|condition${if:${cut:7,,${tg_trigger_name}}==newsmon?|keep_url|keep_date} || section add|del|set|list|clear || list push|remove|replace|unshift|pop|shift|clear"
/trigger set newsmon_tools conditions "${info:version_number} >= 50397184 && ${tg_argv_eol1} =~ ^set +[[:alnum:]_]+ . || ${tg_argv_eol1} =~ ^section +add +(-(fg|bg|samesep|len|condition) +[^- ][^ ]* +)*[[:alnum:]_]+ +(start|end|none) +. || ${tg_argv_eol1} =~ ^section +set +[[:alnum:]_]+ (fg|bg|samesep|len|condition|content) . || ${tg_argv_eol1} =~ ^section +(list|clear)$ || ${tg_argv_eol1} =~ ^section +del +[[:alnum:]_ ]+$ ||${tg_argv_eol1} =~ ^list +(shift|pop|clear)$ || ${tg_argv_eol1} =~ ^list +(unshift|push|replace|remove) +[[:alnum:]_ ]+$"
/trigger set newsmon_tools regex "/.*/${tg_trigger_name}/my_buffer /_tools$//my_buffer /.*/${tg_argv1}${if:${tg_argv1}!=set? ${tg_argv2}}/my_command /;/\x5c;/tg_argv_eol3 /;/\x5c;/tg_argv_eol5 /\$\{/${\x5cx5c}${re:0}/tg_argv_eol3 /\$\{/${\x5cx5c}${re:0}/tg_argv_eol5 /.*/${if:${my_command}==section add&&${cut:1,,${tg_argv3}}== -?${tg_argv_eol3}}/my_opt_args /( [^- ][^ ]* +)[[:alnum:]_]+ .*/${re:1}/my_opt_args /.*/${tg_argv_eol3}/my_required_args /^-[^ ]+ +[^ ]+ +//my_required_args /.*/${my_required_args}/my_position /^[^ ]+ +([^ ]+).*/${re:1}/my_position /.*/${my_required_args}/my_content /^[^ ]+ +[^ ]+ +(.*)/${re:1}/my_content /.*/${if:${my_command}==section add?${if:${my_position}==start?unshift:${if:${my_position}==end?push}}:${if:${my_command}==section del?remove:${if:${my_command}==section clear?clear:${if:${tg_argv1}==list?${tg_argv2}}}}}/my_list_action /.*/${my_required_args}/my_sections /^([^ ]+).*/${if:${my_command}=~^section (add|set)$?${re:1}:${re:0}}/my_sections /.+/,${re:0},/my_sections / +/,/my_sections /.*/${plugins.var.${my_buffer}.list}/my_list /[^,]+/${if:${re:0}=~^[[:alnum:]_]+$?${re:0}}/my_list /[^,]+(.*)/${if:${my_list_action}==shift?${re:1}:${re:0}}/my_list /(^|,)[^,]+,*$/${if:${my_list_action}==pop?:${re:0}}/my_list /.*/${if:${my_list_action}==unshift?${my_sections}}${re:0}/my_list /.*/${re:0}${if:${my_list_action}==push?${my_sections}}/my_list /[^,]+/${if:${my_list_action}==remove&&${my_sections}=-,${re:0},?:${re:0}}/my_list /.*/${if:${my_list_action}==replace?${my_sections}:${re:0}}/my_list /.*/${if:${my_list_action}==clear?:${re:0}}/my_list /,+/,/my_list /^,|,$//my_list /^,|,$//my_sections ===$===${if:${my_command}==set?/mute /set plugins.var.${my_buffer}.general.${tg_argv2} ${tg_argv_eol3};}===my_cmds_to_run ===$===${if:${my_command}==section set?/mute /set plugins.var.${my_buffer}.section.${tg_argv3}.${tg_argv4} ${tg_argv_eol5};}===my_cmds_to_run ===-([^ ]+) +([^ ]+) +===/mute /set plugins.var.${my_buffer}.section.${my_sections}.${re:1} ${re:2};===my_opt_args ===$===${if:${my_command}==section add?${my_opt_args};/mute /set plugins.var.${my_buffer}.section.${my_sections}.content ${my_content};}===my_cmds_to_run ===$===${if:${my_command}==section list?/mute /set plugins.var.${my_buffer}.section.*;}===my_cmds_to_run /.*/${my_sections}/my_delete_sections ===([^,]+)(,|$)===/mute /unset -mask plugins.var.${my_buffer}.section.${re:1}.*;===my_delete_sections ===$===${if:${my_command}==section del?${my_delete_sections}}===my_cmds_to_run ===$===${if:${my_command}==section clear?/mute /unset -mask plugins.var.${my_buffer}.section.*;}===my_cmds_to_run ===$===${if:${my_list_action}!=?/mute /set plugins.var.${my_buffer}.list \"${my_list}\";}===my_cmds_to_run"
/trigger set newsmon_tools command "/command -buffer core.weechat * /eval -s ${my_cmds_to_run}"
/eval /trigger addreplace newsmon print "${if:${plugins.var.news_buffer_full_name}!=?${plugins.var.news_buffer_full_name}:irc.freenode.##news};irc_privmsg,matrix_message"
/trigger set newsmon conditions "${info:version_number} >= 50397184 && ${tg_displayed} !="
/trigger set newsmon regex "/.*/${tg_message_nocolor}/my_site_and_sections /^\[([^]]+)\].*/${re:1}/my_site_and_sections /.*/${my_site_and_sections}/my_site / - /${color:-underline} /my_site_and_sections / - .*//my_site /.*/${tg_message_nocolor}/my_title /^\[[^]]+\] (.*)/${re:1}/my_title /.*/${my_title}/my_date /.* ([0-9]{4}-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])/${re:1}/my_date /(.*) [0-9]{4}-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]/${re:1}/my_title /.*/${my_title}/my_url ==.* (https?://[^ ]+)==${re:1}==my_url ==(.*) https?://[^ ]+==${re:1}==my_title /.*/${my_url}/my_url_encode /.*/${base_encode:64,${my_url_encode}}/my_url_encode /\+/#/my_url_encode /$/url_${my_url_encode}/tg_tags /.*/${tg_date}/my_date_only /(.*) .*/${re:1}/my_date_only /.*/${tg_date}/my_time_only /.* (.*)/${re:1}/my_time_only /.*/${channel}/my_channel_no_prefix /^.(.)(.*)/${if:${re:1}==#&&${info:irc_server_isupport_value,${server},NETWORK}==freenode?:${re:1}}${re:2}/my_channel_no_prefix /.*/plugins.var.${tg_trigger_name}.general/my_general_prefix /.*/${if:${length:${${my_general_prefix}.bg}}!=?${${my_general_prefix}.bg}:red}/my_default_bg /.*/default/my_end.bg /.*/${plugins.var.${tg_trigger_name}.list}/my_list /[^,]+/${if:${re:0}=~^[[:alnum:]_]+$?${re:0}}/my_list /[^,]+/plugins.var.${tg_trigger_name}.section.${re:0}/my_list /[^,]+/${if:${eval_cond:${if:${length:${${re:0}.condition}}!=?${${re:0}.condition}:${if:${length:${${my_general_prefix}.condition}}!=?${${my_general_prefix}.condition}:1}}}!=?${re:0}}/my_list /[^,]+/${re:0},${re:0}/my_list /^,*[^,]+(.*)/${re:1}/my_list /.*[^,].*/${re:0},my_end/my_list /[^,]+/${if:${length:${${re:0}.fg}}!=?${re:0}.fg:${my_general_prefix}.fg},${if:${length:${${re:0}.bg}}!=?${re:0}.bg:my_default_bg},${if:${length:${${re:0}.samesep}}!=?${re:0}.samesep:${my_general_prefix}.samesep},${if:${length:${${re:0}.len}}!=?${re:0}.len:${my_general_prefix}.len},${re:0}.content/my_list /,+/,/my_list /^,|,$//my_list /([^,]+),([^,]+),([^,]+),([^,]+),([^,]+)()()()()(),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+)(,|$)/${color:${eval:${${re:1}},${eval:${${re:2}}}}} ${if:${eval:${${re:4}}}=~^[0-9]+$&&${eval:${${re:4}}}!=?${if:${lengthscr:${eval:${${re:5}}}}>=${eval:${${re:4}}}?${cutscr:+${eval:${${re:4}}},…,${eval:${${re:5}}}}:${eval:${${re:5}}}${repeat:${calc:${eval:${${re:4}}}-${lengthscr:${eval:${${re:5}}}}}, }}:${eval:${${re:5}}}}${color:${eval:${${re:1}},${eval:${${re:2}}}}} ${if:${color:${eval:${${re:2}}}}==${color:${eval:${${re:12}}}}?${color:${eval:${${re:3}}}}:${color:${eval:${${re:2}},${eval:${${re:12}}}}}}${color:reset}/my_list /.+/${re:0} /my_list"
/trigger set newsmon command "/print -newbuffer ${tg_trigger_name} -tags ${tg_tags} \t${my_list}${my_title}${if:${eval:${plugins.var.newsmon.general.keep_url}}!=? ${my_url}}${if:${eval:${plugins.var.newsmon.general.keep_date}}!=? ${my_date}}"
/newsmon_tools set keep_url ${info:relay_client_count,*,connected}!=
/newsmon_tools section add -fg black -bg ${info:nick_color_name,${my_site};cyan,magenta,green,brown,lightblue,lightcyan,lightmagenta,lightgreen,blue} -len 0 site_name end ${color:underline}${my_site_and_sections}
Note: there is a lot of evaluation in the newsmon trigger (there is also a lot in newsmon_tools trigger but this trigger is only executed when you run the /newsmon_tools command). So if you have no filter (or one that filter not much) for newsmon this can be a bit slow.
This is the new version of the news monitor. In the past, the news was modified on the ##news channel itself but from now on the news are not modified on the ##news channel, they are sent to the core.newsmon buffer. There are a couple of reason for this choice like keeping the log for ##news clean. You can hide the ##news buffer with buffer_autoset.
The first trigger create the newsmon_tools command. The second trigger send all irc_privmsg and matrix_message from the ##news channel to the core.newsmon buffer. Then we create the different section for our powerline bar. Don't use default for the bg of any section, the bar will be ugly, I could use color:reverse to overcome that but weechat-android and glowing-bear doesnt support reverse and i want the output to be good in those relay client too.
/trigger addreplace news_click hsignal news_click
/trigger set news_click regex "/(^|.*,)url_([^,]+)(,.*|$)/${re:2}/_chat_line_tags /#/+/_chat_line_tags /.*/${base_decode:64,${re:0}}/_chat_line_tags"
/trigger set news_click command "/command -buffer ${buffer.full_name} core /input insert ${_chat_line_tags}\x20"
/key bindctxt cursor @chat(core.newsmon):i hsignal:news_click;/cursor stop
This trigger will be triggered when we press 'i' on a news in cursor mode (in general we invoke this with the middle mouse button). 'i' insert the URL in the input bar. If the URL is too long to view it all, simply press return to send it to the channel, which anyway is +m so nobody will see it, and press alt+l to go in bare mode (so you can click on the URL).
/eval /window splith ${calc:9 / ${window[gui_current_window].win_height} * 100 // 1}
/buffer highmon
/window 1
/layout store main-control windows
a layout with two windows, window 1 is the bigger one and the main one used to display anything. Window 2 is suited to display monitors buffers like chanmon, highmon and newsmon
/window 2
/eval /window splitv ${if:${info:version_number}>=50397184?15:85}
/buffer exec.conky
/window 1
/layout store main-control-conky windows
a layout with three windows. Like the above one, the first window is the bigger one but window 2 is now smaller to make some room for window 3 which is use to display conky
nullpointer (https://0x0.st)
/alias add nullpointer /exec -sh -hsignal nullpointer $* 2>&1 | curl -sfSF file=@- https://0x0.st
/trigger addreplace nullpointer hsignal nullpointer
/trigger set nullpointer regex "/\n//out"
/trigger set nullpointer command "/command -buffer ${buffer.full_name} core /input delete_line;/command -buffer ${buffer.full_name} core /input insert ${out}"
This allow you to type /nullpointer uptime for example, to send the output of the uptime command to 0x0.st. Your input bar content will be replaced by the url of the paste. This way you can visit the URL to see if there is sensitive information before giving the url to everyone. You may wonder why I didn't used something like: _/exec -sh -pipe "/input delete_line;/input insert " $* 2>&1 | curl -sF c=@- https://0x0.st Well If we use this, the input bar will be filled with the command and not the url.
≥ WeeChat 3.1 for tg_trigger_name
/alias del devinfo
/trigger addreplace devinfo command "devinfo;infos about WeeChat;[-extra] [-match];-extra: displays extra informations like in how many day the next stable will be released${\n}-match: show if you are up-to-date${\n}${\n}This command retrieve infos about current and next stable version.${\n}${\n}Exemples:${\n} Verbose output:${\n} /${tg_trigger_name} -extra -match;-extra|-match|%*"
/trigger set devinfo conditions "${tg_argv_eol1} =~ ^(-(extra|match) +)*(-(extra|match))?$"
/trigger set devinfo regex "/.*/${tg_argv_eol1}/my_flags /(^| )-/,/my_flags / +//my_flags /.+/${re:0},/my_flags"
/trigger set devinfo command "/exec -norc -timeout 5 -hsignal devinfo${my_flags} url:https://weechat.org/dev/info/all/"
/trigger addreplace utils_date_calc_days info date_calc_days
/trigger set utils_date_calc_days conditions "${tg_arguments} =~ ^[0-9]{4}-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])$ && ${info:python_version} !="
/trigger set utils_date_calc_days regex "/.*/${info:python_eval,from datetime import datetime; date1 = datetime.today(); date2 = datetime.strptime('${tg_arguments}', '%Y-%m-%d'); delta = date1 - date2; print(abs(delta.days))}/tg_info"
/trigger addreplace utils_date_preferred info date_preferred
/trigger set utils_date_preferred conditions "${tg_arguments} =~ ^[0-9]{4}-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])$ && ${info:python_version} !="
/trigger set utils_date_preferred regex "/.*/${info:python_eval,from datetime import datetime; print(datetime.strptime('${tg_arguments}', '%Y-%m-%d').strftime('%x'))}/tg_info"
/trigger addreplace devinfo_hsignal hsignal devinfo*
/trigger set devinfo_hsignal conditions "${err} == && ${info:python_version} !="
/trigger set devinfo_hsignal regex "/.*/${tg_signal}/my_flags /^devinfo//my_flags /(?n)^stable:(.*)/${re:0}${if:${my_flags}=~,match,&&${info:version}!~-(dev|rc[0-9]+)? ${if:${re:1}==${info:version}?${color:121}(as mine!):${color:163}(mine is ${info:version})}}/out /(?n)^devel:(.*)/${re:0}${if:${my_flags}=~,match,&&${info:version}=~-(dev|rc[0-9]+)? ${if:${re:1}==${info:version}?${color:121}(as mine!):${color:163}(mine is ${info:version})}}/out /.*/${info:version_git}/my_git /^[^g]+g(.*)/${re:1}/my_git /(?n)^git:(.*)/${re:0}${if:${my_flags}=~,match,&&${info:version}=~-(dev|rc[0-9]+)? ${if:${re:1}=~^${my_git}?${color:121}(as mine!):${color:163}(mine is ${info:version_git})}}/out /(?n)^(stable_date:)(.*)/${re:1}${info:date_preferred,${re:2}}${if:${my_flags}=~,extra,? (since ${info:date_calc_days,${re:2}} days)}/out /(?n)^(next_stable_date:)(.*)/${re:1}${info:date_preferred,${re:2}}${if:${my_flags}=~,extra,? (${info:date_calc_days,${re:2}} days left)}/out /_/ /out /(?n)^([^:]+:)(.*)/${color:31}${re:1} ${color:default}${re:2}/out /\n/\x5cn/out"
/trigger set devinfo_hsignal command "/print -current -escape ${out}"
The devinfo trigger create the devinfo command which is used to retrieve info from https://weechat.org/dev/info/all/ and tell you if you're up-to-date (if you use the -match flag) and in how many days the next stable will be released (if you use the -extra flag)
/trigger del translate_target_lang
/buffer_autoset add exec.exec.translated_dict short_name dictionary
/set plugins.var.translate_lang fr
/buffer_autoset add irc.*.*fr localvar_set_translate_lang en
/trigger addreplace translate modifier weechat_print
/trigger set translate conditions "${tg_tags} =~ ,exec_cmd_translated_(text|lang),"
/trigger set translate regex "/.*/${color:*_31}${if:${tg_tags}=~,exec_cmd_translated_text,?Translation:Language}${color:reset}\t${tg_message_nocolor}/"
/trigger addreplace translate_hsignal hsignal translate
/trigger set translate_hsignal regex "/.*/${info:spell_dict,${_buffer}}/my_main_spell_dict /,.*//my_main_spell_dict /.*/${env:LANG}/my_env_lang /_.*//my_env_lang /.*/${_buffer_localvar_translate_lang},${if:${_buffer_localvar_type}=~^(channel|private)$?${buffer[${if:${_buffer_plugin}==irc?${info:irc_buffer,${_buffer_localvar_server}}:${info:slack_matrix_server_search,${_buffer}}}].local_variables.translate_lang}},${plugins.var.translate_lang},${my_main_spell_dict},${my_env_lang}/my_lang /.*/${my_lang}/my_debug /^,+//my_lang /([^,]+).*/${re:1}/my_lang /'/'\''/my_lang /.*/${_chat_line_message}/my_chat_line_message /'/'\''/my_chat_line_message /.*/${_chat_word}/my_chat_word /'/'\''/my_chat_word /.*/${if:${_key}==t?translated_text trans -brief -target '${my_lang}' -no-auto '${my_chat_line_message}':${if:${_key}==l?translated_lang trans -brief -no-auto -id '${my_chat_line_message}':translated_dict trans -dictionary -no-auto '${my_chat_word}'}}/my_cmd_suffix"
/trigger set translate_hsignal command "/command -buffer ${_buffer_full_name} * /exec -norc -name ${my_cmd_suffix}"
/key bindctxt cursor @chat:t /window ${_window_number};hsignal:translate;/cursor stop
/key bindctxt cursor @chat:l /window ${_window_number};hsignal:translate;/cursor stop
/key bindctxt cursor @chat:d /window ${_window_number};hsignal:translate;/cursor stop
This let you translate text with the translate-shell program (package has the same name, at least for Debian). If you want to translate something someone said, press the middle mouse button on the message then press 't'. If you want to know the language of the text, press 'l' instead. Finally, you can press 'd' this will open a buffer and call translate-shell in dictionary mode. For the key 't', the target language is choosed like this: if there is a translate_lang localvar for the buffer, use the langage specified by this localvar. If not, check if the buffer is a channel or private and if so, check if there is a translate_lang localvar for the corresponding server buffer. If not, check if the option plugins.var.translate_lang exist. Otherwhise, check if there is a main spell dict set and if not use the LANG env. So, 1) buffer localvar 2) server buffer localvar 3) option 4) main spell dict 5) LANG environment variable
/set weechat.look.highlight *pascalpoitras*
/trigger addreplace day_changed_upgrade_scripts signal day_changed
/trigger set day_changed_upgrade_scripts command "/script update;/wait 10s /script upgrade"
This trigger will update the local script cache and then upgrade all the installed scripts at midnight.
/trigger addreplace modifier_is_nick_valid modifier input_text_display
/trigger set modifier_is_nick_valid conditions "${tg_string_nocolor} =~ ^/nick . && ${buffer.plugin.name} == irc"
/trigger set modifier_is_nick_valid regex "===.*===${tg_string_nocolor}===my_nick ===^/nick (.+)===${re:1}===my_nick ===^-all (.+)===${re:1}===my_nick ===.*===${if:${tg_string_nocolor}=~^/nick -all[ ]?${info:python_eval,infolist = weechat.infolist_get('irc_server', '', '')\nwhile weechat.infolist_next(infolist):\n if weechat.infolist_integer(infolist, 'is_connected'): print(weechat.infolist_string(infolist, 'name') + ' ')\nweechat.infolist_free(infolist)}:${server}} ===my_servers ===[^ ]+===${re:0} ${info:irc_server_isupport_value,${re:0},NICKLEN} ${info:irc_server_isupport_value,${re:0},CASEMAPPING} ${if:${info:irc_server_isupport_value,${re:0},UTF8MAPPING}!=?${info:irc_server_isupport_value,${re:0},UTF8MAPPING}:no}===my_servers ===([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+)===${re:0} ${if:${info:irc_is_nick,${re:1},${my_nick}}!=?valid:invalid}===my_servers ===([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+)===\n${if:${re:5}==valid?${color:016,046}:${color:016,163}}${re:1} ${color:reverse} NICKLEN = ${calc:${re:2} - ${length:${my_nick}}}/${re:2} CASEMAPPING = ${re:3} UTF8MAPPING = ${re:4}${color:016,default}===my_servers ===.*===${re:0} ${my_servers}===tg_string"
This trigger will give you hint about max nickname length and available character in nickname and will also tell you if the nick is valid or not. Also note that weechat has limited support for the rfc8265. For example, on an oragono server with utf8 nickname enabled, weechat correctly report the nickname é as valid but incorrectly report │ as valid.
/trigger addreplace no_notify_duck_command line *;irc.*;irc_privmsg
/trigger set no_notify_duck_command conditions "${tg_message_nocolor} =~ ^[!,.](bef|bang|reload|shop|duckstats|friends|killers)(\s|$) && ${buffer.local_variables.type} == channel"
/trigger set no_notify_duck_command regex "/.*/-1/notify_level"
Disable notify for duck hunt commands like bef, bang, reload and so on. This way I know there is nothing worth reading on a channel so I don't switch to that buffer.
/trigger addreplace utils_holiday info holiday
/trigger set utils_holiday conditions "${tg_arguments} =~ ^(0[1-9]|[1-2][0-9]|3[0-1])-(0[1-9]|1[0-2])$"
/trigger set utils_holiday regex "/.*/${tg_arguments}/ /01-01/HAPPY NEW YEAR!/ /25-12/MERRY CHRISTMAS!/ /[0-9][0-9]-[0-9][0-9]//"
this info is useful for the weechat.look.day_change_message_1_date and _2dates. See these options at the bottom of my configuration.
/key bindctxt cursor @item(buffer_nicklist):v /window ${_window_number};/voice ${nick}
/key bindctxt cursor @item(buffer_nicklist):o /window ${_window_number};/op ${nick}
/key bindctxt cursor @item(buffer_nicklist):V /window ${_window_number};/devoice ${nick}
/key bindctxt cursor @item(buffer_nicklist):O /window ${_window_number};/deop ${nick}
/key bindctxt cursor @chat:s /window ${_window_number};/slap ${_chat_line_nick};/cursor stop
/key bindctxt cursor @item(buffer_nicklist):s /window ${_window_number};/slap ${nick};/cursor stop
/key bindctxt cursor @chat:a /command -buffer ${buffer.full_name} core /input insert ${_chat_bol}\x20;/cursor stop
/key bindctxt cursor @chat:e /command -buffer ${buffer.full_name} core /input insert ${_chat_eol}\x20;/cursor stop
/key bindctxt cursor @chat:w /command -buffer ${buffer.full_name} core /input insert ${_chat_word}\x20;/cursor stop
/key bind meta-meta2-A /bar scroll nicklist * -100%
/key bind meta-meta2-B /bar scroll nicklist * +100%
/key bind meta2-A /input history_global_previous
/key bind meta2-B /input history_global_next
/alias add ame allchan -current /me
/alias add amsg allchan -current /msg *
/alias add cq /allpv /buffer close
/alias add znc /quote znc
/alias add irc_stats /set plugins.var.total_irc_servers 0;/set plugins.var.total_irc_channels 0;/set plugins.var.total_irc_privates 0;/allserv /eval /set plugins.var.total_irc_servers ${calc:${plugins.var.total_irc_servers}+1};/allchan /eval /set plugins.var.total_irc_channels ${calc:${plugins.var.total_irc_channels}+1};/allpv /eval /set plugins.var.total_irc_privates ${calc:${plugins.var.total_irc_privates}+1};/eval I am currently on ${plugins.var.total_irc_servers} server${if:${plugins.var.total_irc_servers}>1?s}, ${plugins.var.total_irc_channels} channel${if:${plugins.var.total_irc_channels}>1?s} and I have ${plugins.var.total_irc_privates} quer${if:${plugins.var.total_irc_privates}>1?ies:y}.;/unset -mask plugins.var.total_irc_*
/alias addcompletion -m close /eval ${if:-m==$*?/allpv }/buffer close
/alias addcompletion %(irc_channel)|%(nick)|%* slap /me slaps $* around a bit with a large trout
/alias addcompletion %(irc_channel)|%(nick)|%* fu /say (╹◡╹)凸 $*
/alias addcompletion %(weechat_commands) multicomm /alias add temp $*;/temp
The multicomm alias is an alternative to /eval -s, but more "secure". If you use eval -s for this purpose (execute more than one command) but you forget that thing like secure variables will be evaluate this can be very bad.
/set irc.look.smart_filter on
/filter add irc_smart * irc_smart_filter *
/set weechat.color.chat_prefix_join 121
/set weechat.color.chat_host 31
/set irc.color.message_join 121
The weechat.color.chat_host option will also set this color for part and quit. To have a different color, for example, a host in red for parts and quits and green for joins, see this.
/set weechat.color.chat_prefix_quit 131
/set irc.color.message_quit 131
/set exec.command.shell bash
/set irc.server_default.away_check 5
/set irc.server_default.away_check_max_nicks 25
/set irc.color.nick_prefixes "q:lightred;a:lightcyan;o:121;h:lightmagenta;v:229;*:lightblue"
/set irc.network.ban_mask_default "*!*@$host"
/set irc.look.buffer_switch_autojoin off
/set irc.look.buffer_switch_join off
/set irc.look.color_nicks_in_nicklist on
/set irc.look.part_closes_buffer on
/set weechat.look.bar_more_down ""
/set weechat.look.bar_more_up ""
/set weechat.look.bar_more_left "◀"
/set weechat.look.bar_more_right "▶"
/set weechat.look.buffer_notify_default message
/set weechat.look.buffer_time_format "${color:245}%H${color:253}%M"
/set weechat.look.color_inactive_message off
/set weechat.look.color_inactive_prefix off
/set weechat.look.color_inactive_prefix_buffer off
/set weechat.look.color_inactive_window off
/set weechat.look.day_change_message_1date "▬▬▶ ${if:${info:holiday,%d-%m}?${info:holiday,%d-%m}:%a, %d %b %Y} ◀▬▬"
/set weechat.look.day_change_message_2dates "▬▬▶ ${if:${info:holiday,%%d-%%m}?${info:holiday,%%d-%%m}:%%a, %%d %%b %%Y} (%a, %d %b %Y) ◀▬▬"
/set weechat.look.hotlist_add_conditions "${away} || ${buffer.num_displayed} == 0"
/set weechat.look.item_buffer_filter "•"
/set weechat.look.prefix_align_min 0
/set weechat.look.prefix_align_max 10
/set weechat.look.prefix_join "▬▬▶"
/set weechat.look.prefix_quit "◀▬▬"
/set weechat.look.prefix_suffix "│"
/set weechat.look.read_marker_string "─"
/set weechat.look.separator_horizontal ""
/set weechat.color.bar_more 229
/set weechat.color.chat_highlight lightred
/set weechat.color.chat_highlight_bg default
/set weechat.color.chat_nick_colors "cyan,magenta,green,brown,lightblue,lightcyan,lightmagenta,lightgreen,blue"
/set weechat.color.chat_prefix_more 31
/set weechat.color.chat_prefix_suffix 31
/set weechat.color.chat_read_marker 31
/set weechat.color.chat_time 239
/set weechat.color.chat_delimiters 31
/set weechat.color.separator 31
/set weechat.color.status_data_highlight 163
/set weechat.color.status_data_msg 229
/set weechat.color.status_data_private 121
/set weechat.color.status_more 229
/set weechat.color.status_name 121
/set weechat.color.status_name_ssl 121