through countless years, a lazy life series

Wednesday, August 24, 2011

Living in the terminal.

It's been a while since I made a post. I haven't had the mood for writing lately. Today it's gonna be a technical post, a new work environment I've set for my self on my machine and I wanted to share with you guys. I will try to make this short.
Recently I was introduced by Waleed Tuffaha to tmux. A screen like terminal multiplexer that provides some nice feature which are not there in screen. This is not gonna be my main topic of this post but I encourage you guys to try it out . This link show why it's better than screen and some basic configurations that you might need as a starter.
tmux has been my main program to use on Ubuntu recently. I am using it to write my codes, write my TEX documents, do my chats and quick Google searches (:. In this post I will tackle the chat part. I believe the more you have in your CLI the faster you can manage your work and spare time activities (such as chat).
My main chat protocols are IRC, MSN and Skype. In this post I will talk about IRC and MSN in terminal and leave Skype for another post. Maybe.
The following figure shows a preview of the work environment in tmux where I have a normal terminal pane and a pane with vim editing a TEX file.

IRC:
I won't go into much details as the tool is available in the repositories. All u have to do is install weechat using one of the following:
  • $sudo apt-get install weechat
  • #apt-get install weechat
Jk , You shouldn't be in the second case often (:
Once weechat is installed, you can run it by typing "$weechat-curses" in your terminal. The figure below shows weechat running on my machine. Once there you need two commands to reach our #geex channel which are:
  1. /connect freenode
  2. /join #geex (ofcourse you need to do this after you are connected to the server)
You can check the help for commands in there, you can also write your own scripts to handle events in many scripting languages. Am not doing any though, cause tmux would notify me if something changes in that pane such as a new chat or so. You can switch between channels and private chat windows with "alt+window number" which shows down the window. Usually 1 is the server window, 2 is the channel, and so on.

MSN:
This is more tricky as the program am using is not available on the repositories of Ubuntu. There is a library for MSN for many programming languages as far as I know and you can write your own program, but why bother? I found a ready program called "gtmess".
The installation process was simple. You have to download the following archive. And follow the following steps:
1-Copy the archive to a temporary folder where you want to compile and build the program. You can delete this folder after you finish your installation.
2-In that folder open a terminal window and start by extracting the archive using:
tar zxf archiev-name (-C location)
The archive name should start with gtmess when downloaded. The -C location is optional in case you want to extract in a different directory than where your archive is.
3- In the extracted folder do the following:
  • Configure by running "$./configure." In my case I was missing the ssl library, the issue was solved by installing libssl-dev ($sudo apt-get install libssl-dev). You might encounter other missing dependencies but I am sure you can manage if that was the case.
  • Make by running"$make" in the folder.
  • Install by running "$sudo make install".
Simple ain't it (:.
Once you are done, you can run the program by typing "$gtmess" and you should get the interface as in the figure below. Don't worry, you'll get used to the interface quickly.
Following are some useful shortcuts you need to start with. Press F9 to receive a menu where you can navigate using the arrow keys and enter to choose. Choose "connect" to start, and input your email and password when asked. Once connected you get a list of contacts on the right. You can press tab to switch to the contacts, scroll down with arrow keys and press enter to start a chat. You can create a new chat window by pressing "ctrl+N" and invite users to it by typing their nicknames. You can switch between chat windows by pressing F1 and F2 . Finally you can hide your offline contacts by pressing "ctrl+F".
Those are main keys I use in the program, you can find more by typing ? in the window and pressing enter (of course ..) to get a list of useful keyboard shortcuts.

Simply, you can keep in contact with your family and friends while doing work. Using a key or two to quickly switch between both and not having to move the mouse (:. Hope you guys enjoy this.

*Note: As the screenshots suggest, this was written early in the morning. Thus, many mistakes might exist, I will correct them when noted.