Saturday, 18 September 2010

Guide to Using Finch - Terminal-Based Chat Client

Finch is a TUI (text user interface) IM client for Linux which uses libpurple, the same library on which the GNOME IM client Pidgin is based on. Usually, if you have Pidgin installed, you should have Finch too, unless Pidgin was compiled with the text interface option disabled. In addition to this, Finch supports every protocol that Pidgin supports, and even though it is a terminal-based application, it offers enough configuration options, and more can be done using the .gntrc configuration file, which is discussed later in this guide. If not, installing the latest Finch release, even from source, should be easy.

To install it in Ubuntu, open a terminal and type sudo apt-get install finch or use the Ubuntu Software Centre to search for it and install it. On Debian, you can install the older version from the repositories, or use this guide to compile and install the latest version. Yahoo! for example changed its protocol, so the version which comes included in Debian Lenny is not able to connect to it.

A little about installing as a normal user, using a different prefix. I have Pidgin (and Finch for that matter) 2.7.3 installed in Debian Lenny under the /home/embryo/usr prefix, so my binaries are located in /home/embryo/usr/bin/ and the manual pages in /home/embryo/usr/share/man/man1/finch.1/ and /home/embryo/usr/share/man/pidgin.1/ respectively. So in order to launch them I need to include the first path into my $PATH variable. To do so, edit your ~/.bashrc file using a text editor, and add this line at the end:

export PATH=$PATH:/home/USER/usr/bin

Replace USER with your username (and the full path if your prefix was different). Now, I don't know if there is another workaround for this, but i noticed that man finch or man pidgin do not work after installing in a different path than the standard ones. The manual pages for them actually exist, but in the directory /home/embryo/usr/share/man/man1/. So, to access them, use these commands:

man -l /home/USER/usr/share/man/man1/finch.1
man -l /home/USER/usr/share/man/man1pidgin.1

The -l argument tells man to open a manual page (and format it) for a custom file provided by the user.

Now that Finch is properly installed, let's get to work. First, type finch in a console to fire it up:

Finch is built using the ncurses toolkit, which is a library designed especially to built text user interfaces. To navigate in a Finch window, use Tab to focus the next widget (option, tickbox, button), Shift+Tab to focus the previous one, Space in order to tick/untick an option, and Enter to 'click' a button. You will also need to press Esc to exit from menus such as the Actions menu.

The first time it starts, Finch automatically opens the accounts window, so you can now select the Add button and press Enter. In the window that appears - New Account - use the arrows to select the desired protocol, and then use Tab to navigate to the next field, fill it in with your data, and so on:

Creating a new Yahoo! account

Next, save your newly created account. Now, to close the Accounts window, press Alt+C. You should be now able to see your contact lists since Finch will try to automatically connect to the protocol you specified.

New mail notification

Now, before moving on to configure Finch, first let me list the most important keyboard shortcuts which are useful to navigate, customize and use this application.

Moving around

Alt+Q - just so you know this quits Finch, getting back to console

Alt+A - opens the Actions menu, which contains everything you need to configure Finch: accounts, buddy lists, file transfers, plugins, sounds, preferences and statuses; use the Esc key to close this menu when you're done

Alt+C - closes the currently opened window

Alt+N - switch to the next window; you will need this to switch between chats, and other openend windows

Alt+P - switch to the previous window

Moving and resizing windows
There are two important shortcuts here, which will help you to:

1. Move windows in Finch
For this, use the Alt+M keyboard shortcut. This will highlight the currently selected window so you will be able to use the arrow keys in order to move it anywhere inside the terminal; use Esc to deselect it when you're done.

2. Resize windows in Finch
Press Alt+R in order to highlight the currently selected window, then use the arrow keys to resize it; press Esc to deselect it when you're done.

Configuring Finch
To configure Finch, press Alt+A, which will open the Actions menu. Here you can edit accounts, enable/disable plugins or configure general Finch preferences. For now we will focus on the the Preferences entry:

As you can see, you can configure the:
- Buddy List - to turn on/off showing idle times or offline buddies
- Conversations - to show timestamps or notify buddies when you are typing them a new message
- Logging - the log format, which can be plain text or HTML (formatted), also which types of events to log
- Idle - which will report idle time based only on the last time you typed something in Finch (anywhere in Finch) or since the last message you send; also the number of minutes before becoming idle

Configure this to your liking. A little more about configuration options: they are kept in the same directory for both Finch and Pidgin, and changes done to one of them affect the other. The configuration files and the logs can be found inside the ~/.purple/ directory, where ~ is your home directory. Notice that .purple is a hidden directory, so make sure that your file manager will list those (or use ls -a in console to view them).

Finch comes bundled with several useful plugins, like Buddy Notes, TinyURL or the Log Reader:

To open the above window, press Alt+A and go to the the Plugins entry. Configure those as you wish.

The ~/.gntrc file
This file allows you to configure Finch in more detail, including colors for its interface, re-binding keys, change keys for various Finch actions, and even enable mouse support.

Here's how to enable mouse support. Open up a text editor and edit (or create if it doesn't already exist - and it probably won't) the ~/.gntrc file:

nano ~/.gntrc # or gedit ~/.gntrc

Next, add the following lines in this file, then save it:

mouse = 1

This is all. Notice that if the file is already created, you should find the section [general] and set the mouse option to 1 (true). Although the manual page says the mouse support is still experimental, I found no issues with it. However, manipulating Finch actually seems harder with a mouse after using it exclusively from the keyboard.

Why use Finch at all?
Well, don't if you want avatars and all the beauty a graphical client offers! Use Pidgin, Empathy, Kopete or something else! But if you need for some reason (speed, lack of memory etc) a terminal-based application for instant messaging, then give Finch a try.

This should be all for today. I hope you'll enjoy Finch as much as I do!

Further reading
Don't forget man finch - it has all the info you need (and more about all the ~/.gntrc file, which couldn't be covered in this guide). The official homepage and guide:
Using Finch
Finch homepage


Elder Geek said...

Finch is perfect for use at work. I use tilda/yakuake to create a drop down terminal to run finch in. This way I can get to my instant messenger with the press of F12 and make it go away just as easily.

I have set the sound command to run a shell script with the following contents.

notify-send -i /usr/share/pixmaps/radiotray.png "Finch: `date +%I:%M`"

This way I can be unobtrusively notified of incoming messages. It is much better than all of the "beeps" of incoming messages while you are trying to hold a conversation with someone in your office.

Anonymous said...

I primarily use finch because it combines well with screen. set up ssh, run 'screen finch', and you can jump onto your existing finch session from any computer with an internet connection, seamlessly.

Anonymous said...

I like this program tons. But it would be nice if the Buddy List could be side by side with the chat boxes, instead of overlapping. I still use Finch, but this would be a sweet addition, so you could see the buddy list and chat box at same time like pidgin. I am not sure why it overlaps in Finch.

Rat said...

Even without the GUI, Pidgin exemplifies the wonderful tradition of dependency hell. They're the best at it.

$ sudo apt-get install finch
[sudo] password for rat:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
gstreamer0.10-nice gstreamer0.10-plugins-bad gstreamer0.10-plugins-good libaa1 libass4 libavc1394-0 libcaca0
libcdaudio1 libcelt0-0 libdc1394-22 libdca0 libdirac-encoder0 libdirectfb-1.2-9 libdv4 libdvdnav4 libdvdread4
libenca0 libexempi3 libfaad2 libfftw3-3 libflac8 libflite1 libgme0 libgpm2 libgsm1 libgssdp-1.0-2
libgstfarsight0.10-0 libgupnp-1.0-3 libgupnp-igd-1.0-3 libiec61883-0 libiptcdata0 libjack-jackd2-0 libkate1
libmeanwhile1 libmimic0 libmms0 libmodplug1 libmpcdec6 libmusicbrainz4c2a libnice0 libnspr4-0d libnss3-1d libofa0
liboil0.3 libproxy0 libpurple0 libraptor1 librasqal2 libraw1394-11 librdf0 libsasl2-modules libschroedinger-1.0-0
libshout3 libslv2-9 libsndfile1 libsoundtouch1c2 libsoup-gnome2.4-1 libspeex1 libsysfs2 libtag1-vanilla libtag1c2a
libts-0.0-0 libusb-1.0-0 libv4l-0 libvpx0 libwavpack1 libwildmidi1 libzbar0 libzephyr4 pidgin-data tsconf
0 upgraded, 72 newly installed, 0 to remove and 0 not upgraded.
Need to get 38.9 MB of archives.
After this operation, 87.5 MB of additional disk space will be used.

Mind you, this is a text only headless server that has no soundcard or graphics card installed and is booting off a 2GB thumbdrive. libmusicbrainz4c2a, libmodplug1 and gstreamer? Seriously? For a console only IM client?

Anonymous said...

Finch has way to much GUI packages and dependecies comming with it :/

wah said...

compile from source and disable audio/video

Anonymous said...

If you're a Gentoo user, just do a -gtk -gstreamer in your package.use file for Pidgin.

This should give you Finch without the GUI dependencies. It can probably be trimmed down even more. Feel free to euse -i the rest