Mouse support for WeeChat – Catch mouse events in WeeChat

Welcome

This page will explain something about Mouse support in WeeChat.

Mouse support is possible through a series of scripts: buffers, coords, urlopener_remote and menu.

There is mouse support in core in the latest WeeChat development versions now. However, it still remains inferior to my mouse scripts (no text, URL, clipboard support). Until those features make their way into core, I will keep this page.

The buffers.pl script supports the mouse to switch and sort buffers. Get it from the official site.

coords.pl – regain URL clicking and select / copy support


native URL recognition

(Read the coords.pl instruction manual.)

Note: this script, as well as some of the following ones, requires the Nlib.pm library to be installed into your WeeChat perl directory.

The Nlib.pm library contains some functions to process mouse input more easily.

(Developer note. read the Nlib.pm reference manual.)

As select and copy is impaired when the mouse mode is enabled, it is necessary for applications to natively support selection and copy when tracking mouse events.

With coords.pl loaded, you can directly use your mouse to select text in the chat window. This has the added benefit of working with vertical splits and nicklist properly. (screenshot)

Another nifty feature is that URLs in chat can be detected and directly clicked on. Again, this will work despite line breaks, so especially well for long URLs.

Note: the following functions require WeeChat version 0.4.0+ or a WeeChat development version: interactive highlighting. double-click support for word wise selection.

urlopener.pl – companion to react to URL clicks

By default, when in xterm, the coords.pl script will only copy the URL you clicked on into the selection. That will allow you to open it in Firefox or your favourite browser by a simple middle click.

If you need more convenience, the urlopener.pl script might be for you. Whenever you click on an URL, it will execute a specific action such as opening your web browser (or text mode web browser in tmux and screen).

(Note. you can easily modify the source code to call the web browser program you want, in tmux and screen it is "w3m" by default.)

urlopener_remote.pl – companion to react to URL clicks and do remote things

(Read the urlopener_remote.pl instruction manual.)

If you are running WeeChat on a remote host and want the web browser to open locally, you should check out this remote alternative to urlopener.pl. Make sure to read the instruction manual if you want to use it.


nick popup

(Read the menu.pl instruction manual.)

What good is the mouse for with no menu to click on?

menu.pl will add a menu system to WeeChat that you can configure yourself to run whatever command you like. By default, you can split and close windows with a mouse click.

If you click on the nicklist, the nick popup will open with useful operations to be done on a nick.

With coords.pl loaded as well, you can also click on a nickname on the left side to do the same.

The nick popup contains the usual entries to Query, Whois, Kick and Op a user. A Slap entry can be added easily.

With buffers.pl loaded, you can right-click on buffers in the buffer list to open a buffer context menu.