Setting up Wordweb equivalent dictionary KDict on Ubuntu

| | 4 min read

Wordweb is one of the most useful tools for a content developer or a technical writer working on a plain old Windows machine. When somebody like that moves to Ubuntu from Windows he/she would want to have a somewhat similar functionality in Ubuntu too. In GNU/Linux there is the gnome-dictionary or the kdict application that has similar functionality as wordweb. However some minor tweaks are required to make these applications behave almost exactly like Wordweb.

The default configuration of gnome-dictionary and kdict is to use web based open dictionaries hosted on dict.org. These applications can also connect to any dictionary server following the DICT protocol. The dictd is one such application and you can easily install dictd on your local PC to avoid connecting to the net to get your word meanings. The following article is written for Ubuntu and kdict but the instructions should work for any other distribution like fedora or Suse conceptually.

First you have to install a local dictionary server. You can do that by running

sudo apt-get install dictd dict-gcide dict-moby-thesaurus

Once the dictionary server is installed you will need to install at least one of the many free databases with the word definitions to be used by dictionary server. You can start with dict-wn and dict-moby-thesaurus.
sudo apt-get install dict-wn dict-moby-thesaurus
Now that you have setup a dictionary server you can access the dictionary with the already existing gnome-dictionary application or install the slightly more advanced kdict application. You can install the kdict application by running

sudo apt-get install kdict

To use the locally installed dictionaries you will have to configure kdict. To do this open kdict >> settings >> Configure Dictionary >> Server. Change the server name to localhost and leave the port as
2628. Disconnect from internet and make sure that you can access word definitions using Kdict.

One distinct advantage that kdict has over gnome-dictionary is its ability to set up internal keyboard bindings that allows you to use shortcut keys within the application. One useful feature in wordweb is its ability to lookup the definition of a word from an already displayed definition by just double clicking on the word. kdict can be configured likewise by going to Settings >> Configure Shortcuts and then configuring a shortcut key for "Define Clipboard Content" action. A suggested shortcut is to use the spacebar. So all you have to do to cross lookup while within kdict itself is to select the word using mouse or touchpad and then press space.

The best part about wordweb is its ability to attach itself to a shortcut key binding that can bring up the dictionary with the definition of the selected word from any other application. By default you have to launch kdict from the menu or from the command prompt. There is a small hack that will allow you to launch it exactly like wordweb. For this you need gnome-conf-editor - a gnome configuration utility similar to the regedit in Windows. In ubuntu Hardy Run

gconf-editor

to launch gnome-conf-editor. Note that you don't have to run this as root because that would only configure the gnome settings for the root user.

In gnome-conf-editor goto / >> apps >> metacity >> keybindings_commands >> command_1
or whichever is the first command which is not assigned. Click on the command in the right pane and then right click and select "Edit Key". Set the value as /usr/bin/kdict --clipboard. If you are using gnome-dictionary instead you will have to install xclip as well and use the following command instead - /usr/bin/gnome-dictionary "`xclip -o`". This will create a command that has to be run for a given key combination. Now to set the key combination, goto / >> apps >> metacity >> global_keybindings >> run_command_1 (or the corresponding key to the command you selected above) and then right click and edit the key as <Ctrl><Alt>W

Now test the settings by opening firefox and selecting a word from any website and clicking Ctrl + Alt + w. If everything is set up correctly kdict should start up with the definition of the selected word. If you have problems setting up the application or if you would like guidance for other distros like Fedora or OpenSuse, you can use the comment form below to post your questions and we will try to help you in whatever way we can.

Update: In ubuntu intrepid kdict has been taken out from the repository. You can still install it by going to the following URL https://launchpad.net/ubuntu/intrepid/i386/kdict/4:3.5.9-0ubuntu1