Skip to content

Instantly share code, notes, and snippets.

@pascalpoitras
Last active July 1, 2023 18:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pascalpoitras/8cb888302d2eabc628c0eb6e035f7577 to your computer and use it in GitHub Desktop.
Save pascalpoitras/8cb888302d2eabc628c0eb6e035f7577 to your computer and use it in GitHub Desktop.
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"

Then, on buffer switch, if the buffer have a irc_smart localvar, it will enable the filter. To add the localvar irc_smart to a buffer, press meta-!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment