jasonwryan.com

Miscellaneous ephemera…

Using Uzbl

Arch &
uzbl

A couple of weeks ago, I switched my default browser from Conkeror to uzbl. It wasn’t that I was dissatisfied with Conkeror per se; more that as I was almost exclusively using vim-like applications, it seemed almost perverse to be browsing with an application that used Emacs-style keybindings. Over time, the simplest operations seemed—in comparison to Vim— to demand ridiculously complex key strokes.

So, I installed uzbl.

Uzbl follows the UNIX philosophy - “Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface.” uzbl homepage

Consequently, the default uzbl version is designed to do little more than browse web pages. It doesn’t handle cookies, manage downloads, block ads, save bookmarks, or do any of the things that you would expect of its WebKit kin, Firefox Safari and Chrome.

This isn’t to say that it can’t do any of these things; like any well-designed UNIX program, it is extensible and interoperable with programs through a range of scripts. The difference is that you get to choose which functionality matters to you, and implement it on an as-needs basis. This makes uzbl very light, very fast, and very powerful.

The version I installed, uzbl-tabbed, ships with a number of default scripts that perform most of the functions that you will need. There is also a scripts page on the wiki that has a growing number of scripts contributed by users.

I installed a couple of Pat Brisbin’s scripts; an ingenious bash script for bookmarking that creates an HTML page of your bookmarks that you can serve locally or remotely (I keep mine on Dropbox so I can access it from my phone as well), and a tidy little download manager.

Like Vim, uzbl is modal; you switch between command and insert mode. By configuring uzbl to use Vim key bindings, you can seamless integrate it into your desktop environment. Here you can see the status bar showing uzbl in command mode, on the Arch forums home page, which has completely loaded (the other figure is the X root window number).

image

As an Arch Linux user, I’m keen to support a project that has been developed by the Arch community (if you want to see the history of the project, there is a long thread on the Arch boards); but ultimately this software appeals because it is so configurable: you can customize it to your heart’s content (see my config file on my mercurial repo).

There are packages for most of the major distros: give it a go.

Wikipedia Discriminates Against FOSS

There is currently an interesting debate on Wikipedia about deleting the article on dwm.

According to the Wikipedia notability guidelines, only

significant coverage in reliable sources that are independent of the subject

constitutes notability.

So 300 words by the likes of Randall Kennedy counts for more in terms of “notability” than the hundreds of thousands of lines of code contributed to dwm and its forks (awesome and echinus) and clones (xmonad, musca, scrotwm et al)?

The notion that, in the free/libre and open source software world, a project’s notability is measured in terms of the prose that appears in journals, books etc is myopic and—in terms of Wikipedia’s status as a FOSS project—quite disappointing. The real measure of notability of projects like this is the code they generate.

Wikipedia’s criteria actively discriminates against free and open source projects where the measure of notability is not the column inches in trade magazines sponsored by advertising and advertorial, but by the passion and commitment of large communities of contributors who believe in the project enough to devote their code, time and money.

Wikipedians need to review their criteria to reflect this reality; otherwise the “free encyclopedia” will continue to exclude exactly those free/libre projects…

Mapping CapsLock to Escape in Ubuntu

The CapsLock key is one of the best examples of persistent usability failure; it continues to appear on just about every English-language keyboard, despite the fact that —aside from no-one ever uses it— it is an active hindrance to both the average typist and the sedulous coder…

As a matter of course, I remove it in my Arch machines with an entry in my .xinitrc, but in Ubuntu/Gnome, there is no such file. Consequently, there is this equally effective way of dispatching the CapsLock, or in my case, mapping it to something actually useful, Esc.

First, create the mapkey file in your home directory:

1
xmodmap -pke > ~/.xmodmap.mapkey

Then open the file and edit it:

1
vim ~/.xmodmap.mapkey

Look for the CapsLock key, on my machine it is 66 (you can use xev to locate all of your key codes), and then wreak your revenge. Just deleting everything after keycode 66 =

will render it useless, which may suit your style. I change the entry to make it another Escape key:

1
keycode 66 = Escape NoSymbol Escape NoSymbol Escape

Log out and when you log back in, you have a useful key.

Updated for 10.04

The above hack was for 9.10 and earlier versions of Ubuntu. I have no idea why, but it (alone) doesn’t work in Lucid Lynx. You need a couple of extra steps:

Open System > Preferences > Startup Applications and add two new items:

  • Clear the CapsLock key with xmodmap -e "clear Lock
  • Map it to Escape by pointing to your xmodmap file
1
xmodmap ~/.xmodmap.mapkeys

Now, whenever you login the script(s) will run and your CapsLock will map to something actually useful, like Escape.