Skip to content

Instantly share code, notes, and snippets.

View pascalpoitras's full-sized avatar

Pascal Poitras Dubois pascalpoitras

  • Longueuil, Quebec, Canada
View GitHub Profile
@pascalpoitras
pascalpoitras / config.md
Last active October 7, 2024 01:35
My WeeChat configuration

WeeChat Screenshot

Mouse


enable


@pascalpoitras
pascalpoitras / difference-focus-bind.md
Last active June 1, 2024 17:20
difference-focus-bind.md

the hook_focus is triggered only if there's already a bind

for example the buflist already have a mouse bind so

/trigger add buflist_click focus buflist "" "" "/print -core clicked on buflist item"

then click on the buflist, the message is print

the time item in the status bar doesn't have any bind by default so

@pascalpoitras
pascalpoitras / line_bar.md
Last active December 6, 2023 22:48
bar at the bottom very ugly hack
/trigger add myline_refresh signal signal_sigwinch "" "" "/item refresh myline"
/item add myline "" "${repeat:${info:term_width},${color:underline} }"
/bar add myline root bottom 1 0 myline
/bar set myline priority 9000
@pascalpoitras
pascalpoitras / cycle_cond.md
Last active August 10, 2023 16:12
made for someone on IRC

WeeChat Screenshot

Aliases

/alias add cycle_build /mute /unset plugins.var.buffer_cycle;/mute /set plugins.var.buffer_cycle_cond $*;/allbuf /eval /${if:${eval_cond:${plugins.var.buffer_cycle_cond}}!=?mute /set plugins.var.buffer_cycle ${plugins.var.buffer_cycle} ${buffer.name}}
/alias add cycle_cond /cycle_build $*;/eval /mute /buffer cycle ${plugins.var.buffer_cycle}

Examples

/cycle_cond ${channel} =~ l

@pascalpoitras
pascalpoitras / irc-smart-per-filter.md
Last active July 1, 2023 18:37
irc smart per filter toggling (made for someone on IRC

It seems we can't toggle a filter per buffer (we have @ but it applies to all the filters of the buffer). Here is a hack that enable or disable the irc_smart filter globally depending on a buffer localvar

/script install buffer_autoset.py

/key bind meta-! /mute -core /eval /toggle buffer_autoset.buffer.${buffer.full_name}.localvar_set_irc_smart 1 0;/mute -core /eval /filter ${if:${buffer_autoset.buffer.${buffer.full_name}.localvar_set_irc_smart}!=?enable:disable} irc_smart

/trigger addreplace irc_smart_toggle signal buffer_switch
/trigger set irc_smart_toggle command "/mute -core /filter ${if:${buffer_autoset.buffer.${buffer[${tg_signal_data}].full_name}.localvar_set_irc_smart}?enable:disable} irc_smart"
@pascalpoitras
pascalpoitras / warning_color.md
Last active June 10, 2023 16:26
I created this for someone on IRC

weechat screenshot

/item addreplace warning_color "${buffer.local_variables.is_color_enabled}" "${color:black,red}+c is ON"

/trigger addreplace warning_item_build signal *,irc_in_MODE;*,irc_in_324
/trigger set warning_item_build conditions "${tg_signal} =~ 324$ || ${tg_signal} =~ MODE$ && ${param2} =~ (?-i)c"
/trigger set warning_item_build regex "/.*/${if:${tg_signal}=~MODE?${param2}:${param3}}/my_mode /(?-i)[^-+c]//my_mode /.*/${if:${my_mode}==*+c}/is_color_enabled"
/trigger set warning_item_build command "/command -buffer ${buffer[${info:irc_buffer,${server},${channel}}].full_name} * /buffer setvar is_color_enabled ${is_color_enabled};/item refresh warning_color"

Instructions

@pascalpoitras
pascalpoitras / a_very_different_newsmon.md
Last active April 30, 2023 03:48
different version of newsmon made for someone on IRC
/trigger addreplace news_transform line "*;irc.libera.#*;nick_newsly+irc_privmsg,nick_CarlSagan+irc_privmsg,nick_Chunt+irc_privmsg,nick_Brainstorm+irc_privmsg,nick_Bridgestorm+irc_notice"
/trigger set news_transform conditions "${channel} =~ ^(##alerts|##news|##science|#securitynews)$"
/trigger set news_transform regex "/.*/${info:news_parse,site_and_sections,${tg_message_nocolor}}/my_site_and_sections /\|/ - /my_site_and_sections /.*/${if:${channel}==##alerts?${if:,${tags},=-,irc_notice,?[${color:red}NOTICE${color:reset}] ${split:2, ,keep_eol,${tg_message_nocolor}}:[${define:my_site,${info:alert_parse,site,${tg_message_nocolor}}}${color:${info:nick_color_name,${my_site}}}${my_site}${color:reset}] ${info:alert_parse,title,${tg_message_nocolor}} ${info:alert_parse,url,${tg_message_nocolor}}}:[${color:${info:nick_color_name,${my_site_and_sections}}}${my_site_and_sections}${color:reset}] ${info:news_parse,title,${tg_message_nocolor}} ${info:news_parse,url,${tg_message_nocolor}}}/message /.*//prefix"

WeeChat Screenshot

/bar set status name statusbak
/bar default status
/bar set status name spell
/bar set spell items spell_suggest

/bar set statusbak name status

@pascalpoitras
pascalpoitras / gist:d40f3c453912d592b34db0719fe2d646
Last active December 20, 2022 16:30
centered buflist at the bottom

WeeChat Screenshot

need version 3.6 for spacer item

/bar set buflist position bottom
/bar set buflist size 1
/bar set buflist filling_top_bottom horizontal
/bar set buflist items spacer,buflist,spacer

WeeChat Screenshot

Here I will show you how to create a bar very similar to the nicklist bar, but instead of showing nickname, it will show znc commands, whenever you click on a command, weechat will send a "help the_command_you_just_clicked" and insert the name of the command in the input bar, then enter any arguments required to the command and press enter.

You will need the following script

  1. text_item.py

Let's create the bar