For those of us who dislike the Ubuntu Unity interface and its ugly dock, there are several options. The Cairo Dock is the most aesthetically appealing to me, with its Mac-OSX-like animations. But do I really need icons that bounce up and down, and dozens of other visual effects – especially when I’m running a lean desktop like XFCE?

If you’re in this boat, take a walk on Plank. Plank is a minimalist dock from the same team that created Docky. In fact, it’s the code that supplies Docky’s core features. Plank only launches applications, but it’s smarter than some panels. If an instance of the application is already running, Plank will re-open that window instead of starting a new one. Plank has almost no documentation. However, its configuration is so simple that you won’t need any.

Installation

I tried Plank as a replacement for XFCE’s application launcher Panel. In Ubuntu 12.04, the default XFCE desktop comes with two panels. The top one (Panel 1) hosts the application menu and various plugins. The bottom one (Panel 2) is the launcher. I deleted it, then intalled Plank from its PPA:

sudo add-apt-repository ppa:ricotz/docky
sudo apt-get update
sudo apt-get install plank

At this point, you could start the dock manually, from the command line (“plank &“). To make it automatically run when you login to your desktop, open the XFCE Settings Manager | Session and Startup | Application Autostart, and add a new entry, entering /usr/bin/plank as the command to execute. When you logout and login again, your dock should appear at the bottom of the screen.

Basic Configuration

The easiest way to add applications to the dock is to start them from the XFCE Applications Menu. Their icons will appear on the right side of the dock. RMB click on them and select “Keep in dock” to make them appear permanently. Re-arranging the icons is as simple as dragging with the left mouse button and dropping them to their new position. Be careful, though. If you drag an icon off the bar, it’s instantly deleted from the dock, and there’s no way to undo it. Also, you can’t lock icons to fixed positions to prevent accidentally moving or deleting them.

Under the hood, Plank’s configuration is as simple as its operation. In your home directory, the ~/.config/plank/dock1/settings file has all the visual options you can change. I shrank the IconSize from 48 pixels to 36. Plank watches this file for changes and the dock morphs as you save your edits. By default, the Plank dock is visible unless a window overlaps it. If you prefer to always hide the dock until you move the mouse cursor to the bottom of the screen, set HideMode=2.

Advanced Configuration

The quick setup I described above left me with a couple of problems. First, Plank will be started in every desktop environment you run on your computer. I spend most of my time in KDE, where Plank seems superfluous. I edited the .desktop file for Plank in the ~/.config/autostart directory and added a line:

OnlyShowIn=XFCE;

Secondly, how do you quickly restore your configuration if it gets messed up? Your ~/.config/plank/dock1/settings lists the applications, but each of them must be defined in its own .dockitem file in ~/.config/plank/dock1/launchers. One way to prepare for recovery is to regularly back up these directories.

Another way is to automatically (re)generate the .dockitem files from a list. Each file contains a single setting, pointing to the .desktop file Ubuntu automatically created when the application was installed. For example, here’s one for the Transmission BitTorrent app:

[PlankItemsDockItemPreferences]
Launcher=file:///usr/share/applications/transmission.desktop

All we need to rebuild these files, then, is a list of .desktop apps and a shell script to cycle through them and create corresponding .dockitem files. The list of apps (~/my_plank_icons.txt) can be just a text file with the title part of the .desktop filenames:

gnome-terminal
thunderbird
shotwell
simple-scan

The shell script restore_plank.sh consists of:

#!/bin/sh
FILELIST=~/"my_plank_icons.txt"
DESTDIR=~/".config/plank/dock1/launchers"
cd $DESTDIR || exit 1
cat $FILELIST | while read LINE; do
    echo > $LINE.dockitem
    echo [PlankItemsDockItemPreferences] >> $LINE.dockitem
    echo "Launcher=file:///usr/share/applications/$LINE.desktop" >> $LINE.dockitem
done

You can expand on these examples to create portable Plank configurations and multiple docks. It’s easy to experiment because Plank instantly refreshes itself as the files change. For more help, see the Plank Q&A list on Launchpad.