Starting with WeeChat

I’ve been using IRC for some time and although Irssi has served me well, it’s time to try something different. WeeChat is a modular chat client with support for IRC and the interesting part is that it’s possible to use other interfaces like glowing-bear web frontend. WeeChat is similar to Irssi so switching over shouldn’t be an issue. But to get the configuration right and what you had on Irssi needs some effort. Here are my notes about starting with WeeChat and how I like my chat client to look.

Compiling Weechat on CentOS 6

I have my shell on CentOS and although you can find WeeChat from the repositories, it’s quite old (0.4.3 when 1.4. is the newest). So you might want to compile WeeChat by yourself. Compiling WeeChat is explained on the User Guide. You need to install some libraries before you can try using make.

yum install gettext make libgcrypt-devel libcurl-devel python-devel v8-devel gnutls-devel ruby cppunit perl-ExtUtils-Embed

After you’ve installed the needed packages download WeeChat sources and extract the weechat-1.4.tar.gz package to directory you want.

Go to the directory you extracted WeeChat and run the following commands:

$ mkdir build
$ cd build
$ cmake .. -DCMAKE_INSTALL_PREFIX=/path/to/directory
$ make
$ make install

Configuring WeeChat

Quick Start guide helps you to get started so I don’t duplicate that here. If you’re familiar with Irssi you should feel more or less at home. As I didn’t use much scripts in Irssi the most difficult part for me was to create as good theme as I had with Irssi. Otherwise the switch went better than expected.

Start WeeChat with weechat so we can start configuration.

When I started with WeeChat of course I googled how others had configured it and thus my configuration is based on this and some other snippets.

Scripts to improve functionality

/script install buffer_autoclose.py iset.pl colorize_nicks.py urlbuf.py screen_away.py 
  • buffer_autoclose.py: Automatically close inactive private message buffers.
  • iset.pl: Interactive Set for configuration options
  • colorize_nicks.py: Use the weechat nick colors in the chat area and command line.
  • urlbuf.py: Common buffer for received URLs.
  • irssi_awaylog.py: Log highlights/private messages when you are away.
  • screen_away.py: Set away status when detaching and attaching from screen or tmux.

To see and set the options for the plugins you can use /set with wildcard “*”

/set *urlbuf*
/set *away*

You can install scripts also by typing “script search iset” and a selection of available plugins will appear. To leave it type “q” then press enter, if you want to install the script type “i” then press enter.

Adjust layout and colors

Make the title bar and the status bar using dark colors.

/set weechat.bar.status.color_bg 0
/set weechat.bar.title.color_bg 0
/set buffers.color.current_bg 0
/set weechat.color.chat_nick_colors 1,2,3,4,5,6
/set buffers.color.hotlist_message_fg yellow

Place a list of all buffers at the top of the screen

/set weechat.bar.buffers.position top

Merge the server buffers in to one to take up less of our precious screen space (you can switch between them with ctrl-x).

/set buffers.look.hide_merged_buffers server

Hide any channels from the buffer list that haven’t had activity in 10 minutes or less to keep the clutter down.

/set buffers.look.detach 600

Hide joins and parts don’t count as ‘activity’ on a channel.
some filter tweaks to make IRC less annoying.

/set weechat.look.buffer_notify_default message

Hide joins/parts from users that haven’t spoken recently (default is 5 minutes). You can toggle this with ctrl-=.

/set irc.look.smart_filter on
/filter add irc_smart * irc_smart_filter *

When joining a channel, a lot of information is spit out, most of which is redundant. Hide all this with the following command.

/filter add irc_join_names * irc_366,irc_332,irc_333,irc_329,irc_324 *

Some visual bits to make Weechat a bit nicer. Like replace the nickname for a message with a little arrow if the previous message in your buffer was from the same user.

/set weechat.look.prefix_same_nick "⤷"
/set weechat.look.prefix_error "⚠"
/set weechat.look.prefix_network "ℹ "
/set weechat.look.prefix_action "⚡"
/set weechat.look.bar_more_down "▼▼"
/set weechat.look.bar_more_left "◀◀"
/set weechat.look.bar_more_right "▶▶"
/set weechat.look.bar_more_up "▲▲"
/set weechat.look.prefix_suffix "|"
/set weechat.look.separator_horizontal "—"

Prettier timeformat

/set weechat.look.buffer_time_format "${color:252}%H${color:245}:%M${color:240}:%S"

Restrict the length of nicks in the sidebar to 15 characters

/set weechat.look.prefix_align_max 15

Bind alt-n to toggle the nicklist.

/key bind meta-n /bar toggle nicklist

More colors

/set weechat.color.chat_delimiters 29
/set weechat.color.chat_host 24
/set weechat.color.chat_prefix_suffix 24
/set weechat.color.nicklist_away 244
/set weechat.color.separator 60
/set weechat.color.chat_highlight_bg 058
/set irc.color.reason_quit  244
/set irc.color.topic_new  36
/set irc.color.topic_old 244

Get rid of the title bar and just add the buffer name to the input bar

/bar hide title
/bar set input items [time]+ buffer_name+ [input_prompt]+(away),[input_search],[input_paste],input_text

Adjust the input bar

/bar set input items [input_prompt]+(away)::,[input_search],[input_paste],input_text

Save your configuration with

/save

Save layout and buffer order

/layout store

My WeeChat theme is like this

Simple WeeChat setup
Simple WeeChat setup

Relay

You can use WeeChat also with other interfaces than ncurses like web frontends which make using IRC easier on mobile devices.

Add a relay server using the weechat protocol, using port 40900 and setting a password.

/relay add weechat 40900
/set relay.network.password YOURPASSWORD

Now you can connect to your WeeChat with web frontend by using the server where your WeeChat is running and providing the port and password.

Note: Connections with weechat are not encrypted. So it’s better to e.g. setting up WeeChat relay behind nginx.

Clicking on long URLs

By default, WeeChat displays time and prefix for each line and optional bars around chat area which makes clicking long URLs impossible.

To make easier URL click, you have to options as explained in FAQ:

1. Enable option “eat_newline_glitch”, so that new line char is not added at the end of each line displayed (it will not break URL selection):

/set weechat.look.eat_newline_glitch on

2. Move nicklist to top and remove alignment on nick:

/set weechat.bar.nicklist.position top
/set weechat.look.prefix_align none
/set weechat.look.align_end_of_lines time

I found the first option to be better as it lets you to have the prefix after nick and before text. It’s not as good as Irssi has it but it works. I hope they’ll merge this pull request which should make it better.

You can also use the bare display (default key: Alt+l).

Other notes

Joining channels with channel names on different character set, like ISO8859-1 and umlauts. You need to input the octal code for the letter, for example latin small letter a and o with diaeresis:

/eval /join #${\0344}${\0344}kk${\0366}set

Search text in buffer

The default key is Ctrl+r (command is: /input search_text_here). And jump to highlights: Alt+p / Alt+n.

Log all messages on IRC buffers but not join/part/quit messages:

  • All IRC buffers: /set logger.level.irc 3
  • Server and its channels: /set logger.level.irc.freenode 3
  • Specific channel: /set logger.level.irc.freenode.#weechat 3

Configuration with iset

Now you should have basic setup quite right and to continue configurations it’s nice to use iset plugin. Just type /iset to enter the iset screen. You will now see a list of all the parameters which can be modified. If you type something in the input bar, it will look for the pattern in the list of variables. If you want to search through the values, put an = before the pattern.

To change the value, press Alt + Enter then enter the new value (it is possible to navigate through values depending on variable type by pressing the Tab key).

Summary

After short use WeeChat works as well as Irssi and vice versa. It will be seen if I stuck with it or get back to Irssi. I’m not quite satisfied with the configuration but it works well enough.


Posted

in

by

Tags:

Comments

2 responses to “Starting with WeeChat”

  1. Tsuri Kamppuri Avatar
    Tsuri Kamppuri

    Also to note that you could add that the DCMAKE_INSTALL_PREFIX directory is for installing to a custom directory. One can drop the DCMAKE option when installing to a system directory. Being fairly a rookie on building from sources I thought the ‘/path/to/directory’ referred to my WeeChat source directory so my executables ended up in my_weechat_src_dir/bin.

  2. Tsuri Kamppuri Avatar
    Tsuri Kamppuri

    Cheers for the comprehensive guide. You can add cmake to the yum install line too in case people reading this don’t have that installed.

Leave a Reply

Your email address will not be published. Required fields are marked *