Hilight window in weechat

Posted on December 25, 2013 in ConfigPorn • 3 min read

I recently moved from Irssi+Screen to Weechat+Screen (and I’m planning to look at weechat interfaces in the future, to have a local irc client connecting to my server and avoid any latency while typing on low speed internet connection). My first step was to get almost the same setup as irssi. I’m very pleased with what I achieved, and weechat is definitely an excellent irc client, although it lacks a bit of usable documentation sometimes…

To get something like my old irssi, I had to install some extensions, including :

  • text_effects.lua to have some inline text decoration such as *bold* to display bold in bold
  • buffers.pl to have a list of opened buffers
  • iset.pl to set configuration options easily
  • screen_away.py (which is very efficient !) to auto away when I detach my screen session

I extensively used this link and the other articles on weechat on this website, which is a reference in my opinion, to get a working base weechat configuration.

But, one point that wasn’t documented very well, is the use of a hilight window without dedicating a buffer to it. Dedicating a buffer to the hilight window means having an opened buffer in the main window, which is useless. You always select it accidentally by typing the wrong number for another buffer, and it’s hidous in your buffer list (even though you can hide it from there). I don’t know if this could be done in irssi, but in weechat, you can set highmon to use a bar instead of a buffer to display the “hilight window” and this is what we’ll see in the following. I will assume you start with highmon plugin installed and configured, with a hilight window such as the one from Pascal Poitras.

So, first step is to tell highmon to use a bar for output instead of the standard buffer :

/set plugins.var.perl.highmon.output bar

Highmon should have created a bar automatically, to put the messages in. Check weechat.bar.highmon.* options to make sure it did. Next, type :

/set plugins.var.perl.highmon.bar_lines 250

to set the number of lines to be stored in your freshly created bar.

Then, you can edit all the preferences for the bar (size, size_max, position, priority, hide etc.) as for a standard bar, using weechat.bar.highmon.* options. Note that priority is important if you have to bars having the same position. For instance, if two bars are positioned at the top, the priority property will determine which one is above the other one.

One last point is that we’d like to have a title for the new hilight bar (which by default doesn’t have any title). The hack is to use another plugin, text_item.py to display a bar with some text. To make a title “[Hilight Monitor]”, just run (after having installed text_item.py):

/set plugins.var.python.text_item.hilight_monitor_title_text all "[Hilight Monitor]"
/bar add highmon_title top 1 0 hilight_monitor_title_text

And play with the position, priority and colors for the newly created bar to have a nice setup :)

One last important thing is that, contrary to the buffer solution, you won’t be able to clean easily the hilight window and to scroll in it. But, I found two aliases on #weechat (ty @silverd for the aliases) that you can bind to any key if you want:

/alias clear_highmon /mute /set plugins.var.perl.highmon.bar_lines -1;/mute /set weechat.bar.highmon.items "";/mute /set weechat.bar.highmon.items "highmon";/mute /set plugins.var.perl.highmon.bar_lines 250
/alias scroll_highmon_down /bar scroll highmon * y+100%
/alias scroll_highmon_up /bar scroll highmon * y-100%

You can now clear the hilight window with /clear_highmon and scroll in it with the other aliases. So, I think you are good to go for a (quite) perfect weechat setup :)


  • You can define your own keyboard shortcut in the following way:

    /key bind KEY /scroll_highmon

    where KEY is some key or combination of key (for instance meta-meta2-A or whatever you want). You can do the same for /clear_highmon and /scroll_highmon_up.

  • By default, the highmon bar won’t autoscroll. To enable autoscroll, you should set plugins.var.perl.highmon.bar_scrolldown to on.