Setting up weechat to use with the Fedora Element homserver

Some of us weechat to keep track of various chats.

It’s quite a sophisticated terminal client that supports multiple chat protocols via plugins. So, for example, I use it to keep my irc, slack, and now matrix/element chats all in one place (instead of having different clients/browser windows for each).

Here’s a quick list of steps on how to set it up to use the Fedora Element home server.

Install weechat

sudo dnf install weechat

Install the weechat-matrix plugin, following the steps given in the Readme. It’s a python plugin for weechat, and you will need to install a few packages using dnf which are its dependencies that are listed in the requirements.txt file:

sudo dnf install python3-{pyOpenSSL,webcolors,atomicwrites,attrs,logbook,pygments,matrix-nio,aiohttp,file-magic,requests} libolm

then clone the repository, and install it:

git clone git@github.com:poljar/weechat-matrix.git
cd weechat-matrix
make install

This puts the plugin in the weechat python plugin folder.

To use SSO, you also need to copy the contrib/matrix_sso_helper.py file into some location that is in your $PATH, without the .py suffix. I put it in ~/.local/bin but any place in $PATH works.

Run weechat:

weechat

Set up the Fedora homesever:

/script load matrix.py 
/matrix server add fedora fedora.ems.host

When you try to connect to the server, weechat will give you a URL:

/matrix connect fedora

of this form:

https://fedora.ems.host:443/_matrix/client/r0/login/sso/redirect?redirectUrl=http://127.0.0.1:61219

Open that in your browser of choice, it’ll take you to the Fedora Open ID login, and once you authenticate there, weechat will be logged in and your channels/chats will be shown.

Here’s a screengrab of my weechat instance. You see:

  • irc on top
  • Fedora matrix in the middle
  • slack at the bottom (blurred out).

You can then set the plugin to autoload etc., see the weechat docs for more information:

https://weechat.org/files/doc/stable/weechat_user.en.html

Additional tip:

I was getting join/part messages in the Matrix buffers, so I set up a filter to stop them:

/filter add matrixjoinleave * matrix_join,matrix_leave *

matrix_join, matrix_leave are the two tags for join and leave messages, so this filters them out. More on filters in the docs.

For slack, you can use

It looks like the matrix plugin is being re-written in rust, and I’m also seeing this issue where weechat “hangs” on quit, but I don’t quit too often and don’t mind killing it when I do. Not entirely sure what’s causing it, but here’s the issue for this particular bit:

I’ll probably fair this out into a blog post/quick-do or something later, but thought I’d share the info here in the meantime.

7 Likes