LJ Archive

New Projects

Fresh from the Labs

John Knight

Issue #210, October 2011

luakit—Extensible Micro Browser (luakit.org/projects/luakit)

Fellow control freaks, if you enjoy having dominion over just about every aspect of a program, I think you'll like this. Inspired by projects such as uzbl, and developed by fellow Perth-boy Mason Larobina, luakit is the Web browser for those who like the element of control. According to the Web site:

luakit is a highly configurable, micro-browser framework based on the WebKit Web content engine and the GTK+ toolkit. It is very fast, extensible by Lua and licensed under the GNU GPLv3 license.

It is primarily targeted at power users, developers and any people with too much time on their hands who want to have fine-grained control over their Web browser's behavior and interface.

It's hard to notice the discreet tabs, with black for active and gray for inactive, but they're very cool.

This lightweight browser seems to run YouTube with Flash just as well as Firefox and Chrome.

Project code that's both documented and diagrammed—now I've seen everything!

Installation

Pre-made packages/binaries are available on the Web site for Gentoo, Arch Linux, Debian/Ubuntu and Fedora, along with the source code.

As for library requirements, the documentation says you need the following:

  • gtk2.

  • Lua (5.1).

  • lfs (lua filesystem).

  • libwebkit (webkit-gtk).

  • libunique.

  • sqlite3.

  • help2man.

On my Kubuntu system, the lfs package was called liblua5.1-filesystem0. If you're using the source and running into dependency errors, it's worth trying out the above libraries' development packages (usually named -dev) and doing the luakit installation again.

If you're running with the source, grab the latest tarball from the Web site, extract it, and open a terminal in the new folder. Enter the command:

$ make

I'm not sure what resources Mason has used here, but this make script is kind of like a cross between ./configure and make, combining the two—interesting. If you run into any errors here, chances are that you're missing a library dependency somewhere; pay close attention to the output.

Finally, to install luakit, if your distro uses sudo, enter:

$ sudo make install

If your distro uses root, enter:

$ su
# make install

Usage

The actual interface is rather unique. Like the lovechild of Chrome and Vim, the interface is part sleek and modern-minimalist, part old-school hacker. Entering a URL or even clicking Back may leave the uninitiated a little shocked, as the GUI elements one takes for granted are seemingly nonexistent. However, the two main UI elements unlock them immediately: right-clicking and the input bar.

Starting with the input bar, you can enter URLs with o, t or w to open URLs in the same tab, a new tab or a new window, respectively. Right-clicking provides controls like Back, Forward, Stop and so on.

On the subject of tabs, not only was I impressed by their presence in this lightweight browser, but they're also by far the coolest tabs I ever have seen. They nearly blend into the background (perhaps part of their mystique), and at first I didn't even notice their presence. Open some new tabs with t, and the tabs at the top of the browser start dividing evenly, with the active tab a strong black, and the inactive tabs techy-gray.

Much to my surprise (given luakit's minimalist nature) Flash appeared to work without any worries, with YouTube as my first test. Indeed, many pages I thought wouldn't stand a chance, loaded in a way that was both accurate and stable.

Nevertheless, the actual browsing aspect is only half the equation when considering luakit, whose real appeal lies in its endless customizability. The entire browser is constructed by a series of config files, which do all kinds of things, like change what parts of the browser are loaded and in which order, define button combinations and so on.

Regarding this, Mason gave a great response to one of my leading questions that was long and detailed, and it will appeal to anyone who knows what they're doing. Check the Web site if you want to see it.

For the modder who is about jump into coding, luakit's Web site has something I've never actually come across. Unlike 99% of us who just start coding randomly, the Web site has a whole Data Structure Index, explaining each file with flowcharts and documented references—the way we were taught but always avoided!

If any programmers are looking to help out with luakit, Mason recommends porting a Firefox or Chrome plugin that you can't live without. A simple method for ad-blocking also would be greatly appreciated.

At the end of the day, this is one of those projects that will inspire great loyalty among its fans with its own unique style. And if any film-makers working on a hacker movie are reading this and looking for a browser that looks Neo-from-The-Matrix cool, this is the one.

sinfo—Advanced Network Monitoring (www.ant.uni-bremen.de/whomes/rinas/sinfo)

Are you looking to set up some kind of network cluster, but dealing with many different computers, all of which are nearly impossible to keep track of? What if you're in charge of a room full of computers and also of those who are using them (some of whom may be looking to slack off or run something I'll politely dub “objectionable”)? sinfo may be what you're looking for. According to its Freshmeat entry:

sinfo is a monitoring tool that uses a broadcast scheme to distribute information on the status of each computer on your local network. It supports CPU, memory usage, network load and information about the top five processes on each computer. sinfo uses ncurses to display the information in an attractive manner.

sinfo displays invaluable system information over multiple PCs for easy administration.

Further extending sinfo's use with the -s switch provides even meatier information.

Installation

A binary is available for those with Debian-based systems, such as Debian, Ubuntu and the like, and chances are that it's already sitting in your repository. Given that this software also includes a startup dæmon, sinfod, I thoroughly recommend taking the binary option if you can, because a great deal of the process is automated (it's also the version I cover here). Nevertheless, in the interests of distro neutrality, I also cover the source version during the installation, as usual.

As far as library requirements are concerned, you need the following, according to the documentation:

  • ncurses: libraries for terminal handling (tested with version 5.7).

  • boost: peer-reviewed portable C++ source libraries using Boost.Bind and Boost.Signals (tested with version 1.42).

  • asio (>=1.1.0): asio is a cross-platform C++ library for network programming (tested with version 1.4.1).

If you're compiling from source, you need the pesky developer packages as well (-dev). The number of packages under libboost- in particular are quite extensive, so if you run into any problems during make, the libboost libraries may be the culprit, requiring more of its packages before you can install properly.

For those running with source, once you have the library requirements out of the way, grab the latest tarball and extract it. Open a terminal in the new folder and enter the following commands:

$ ./configure
$ make

If your distro uses sudo:

$ sudo make install

If your distro uses root:

$ su
# make install

Before I continue, I should explain that sinfo is broken into two parts: the everyday application and the background dæmon. As for installing the dæmon, I'm going to leave this part to you, because it seems that just about every distro has a different method of dealing with startup processes (and the Debian package takes care of all that). Check the readme files in the source tarball and the Web site for more information if you're still using the source.

Usage

sinfo is a “semi-GUI” command-line program that's actually pretty easy to use, although advanced users can make it do some pretty cool stuff via command-line switches. To run the program in its basic mode, simply enter:

$ sinfo

Assuming that you have sinfo installed only on your machine for now, the information being displayed will be just that of your machine. From this screen, you see all kinds of useful information, such as available memory, CPU utilization, hostnames and so on. The sinfo Keyboard Commands sidebar shows a list of the keyboard commands that drive sinfo, toggling parts of the program with a single keystroke.

However, in this state, it's really just a glorified version of top. The whole point is that you can display information from several machines at once to keep tabs on a LAN. If the other PCs on your network have sinfo in their distro's repository, it should be as easy as installing sinfo via apt-get and the like, then running the program on those machines. As soon as I did that on a second machine, voilà, both PCs were displaying under both installations. Keep installing it on other networked PCs, and the list will grow larger and larger.

Those are the basics out of the way, but what about the extended features? Obviously, I don't have the space to cover everything here (and you really should check the man page for more details), but let's look at some of my favorite features.

At the command line, if you add the -W switch (or alternatively --wwwmode) like so:

$ sinfo -W

the output changes from the usual top-like screen to HTML output instead—very handy for those into things like remote administration with automated Web pages and whatnot.

This is slightly redundant while in the sinfo user interface (simply press the s key), but it's awesome when doing some kind of command-line scripting: add the switch -s (or alternatively --systeminfo), and a big chunk of serious system information is output as well. As an example, my two machines had the following extra information:

192.168.1.2   knightro-bigdesktop i686 
 ↪Linux 2.6.32-27-generic #49-Ubuntu SMP Wed De
cpus: 4  MHz:  800.0
RAM: 3276.5 MByte   swap: 7629.4 Mbyte
load 1min:  0.0   load 5min:  0.1   load 15min:  0.1

192.168.1.1   nhoj-desktop x86_64 
 ↪Linux 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 0
cpus: 2  MHz: 1000.0
RAM: 2007.6 MByte   swap: 2047.3 Mbyte
load 1min:  0.1   load 5min:  0.2   load 15min:  0.1
uptime     0 days, 19:13:03

This kind of information suggests many potential uses, and keeping watch and troubleshooting at LAN parties springs instantly to mind. If any one node is having trouble, there's a good chance that the host will be able to hit the ground running when trying to isolate the problem.

In the end, sinfo is not only well designed, but if it's installed as binary, it's also convenient. Ultimately, I think this application will carve out an instant niche for itself, and hopefully, it will turn into one of those standard applications that are so commonplace, they just become part of the landscape. Maybe porting it would do exactly that.

John Knight is a 27-year-old, drumming- and bass-obsessed maniac, studying Psychology at Edith Cowan University in Western Australia. He usually can be found playing a kick-drum far too much.

LJ Archive