Saturday 18 September 2010

KDocker: Dock Any Application in the System Tray in KDE, GNOME & Xfce

I bet at one point or another you felt you missed the system tray integration feature in some application, be it xterm, an audio player, a file manager or any other program. Well, KDocker is just the thing which comes to help: a simple, yet practical docking application built for KDE4 (older KDE3 version can be found here), but not only. Let me tell you how to use this program in a productive and useful manner.

KDocker 4.3 docking an xterm instance

KDocker is a docking application for KDE4 which allows you to dock any application in the system tray. The great thing about KDocker is that it works not only in KDE, but also in GNOME, Xfce and other window managers which are compliant with the NET WM standard.

The project is hosted on Launchpad, being actively developed, with the latest version (4.4) released earlier this year, on July 17. To install it in Ubuntu, type in a terminal sudo apt-get install kdocker, then launch it by pressing Alt+F2 and typing kdocker in the run dialogue window that appears.

Here's how to use: first, start it, then select the window which you want to dock. Below is a screenshot of xterm docked in the system tray using KDocker:

Here are several options KDocker provides besides only docking applications:
- it allows to skip the taskbar or the pager (so the application is not shown on the taskbar/pager)
- make the window sticky
- iconify when minimized/obscured or focus is lost or on close
- show a balloon when the window title changes

KDocker options

Now, one of the real uses KDocker provides is the ability to run it as a command, e.g. kdocker application_name and eventually create a desktop shortcut to this command, or make it start at the login. For example, creating a desktop shortcut in KDE to automatically start Konsole and put it in the system tray can be done like this:

First, create a file on the desktop (well, on the Desktop Folder widget actually) called anything.desktop (or whatever name you like, but with the .desktop extension). Put the following content in it:

[Desktop Entry]
Exec=kdocker konsole
Icon=konsole
Name=Konsole (Docked)
Type=Application
Comment=Console

Create a .desktop launcher to anything you want to dock

And save the file. Now, you can click that desktop shortcut to launch Konsole in the system tray.


Let's say you want to launch a terminal-based application inside Konsole, which should be docked in the system tray. The example that follows is for Midnight Commander, the powerful file manager with a text user interface:

[Desktop Entry]
Exec=kdocker konsole -e mc
Icon=konsole
Name=Konsole (Docked)
Type=Application
Comment=Console

The -e argument tells Konsole to execute the command mc after starting.

Launching Midnight Commander in Konsole and docking it in the system tray

Have some more uses for KDocker? Please share in the comments below.

3 comments:

Fitzcarraldo said...

Nice tip. Thanks.

Actually the first step is to install KDocker - it wasn't installed by default with KDE 4.5.1 in the distro I'm using.

KDocker works nicely. I didn't have to use the .desktop suffix for the file name of the Desktop Config file; I found it works fine with any file name.

Dulwithe said...

So, can kdocker set windows to "minimize to tray" when the "close" button is pressed?

This is the functionality that I really want (so I can clean up the task bar when certain windows are closed, but have the application still running in the background).

Right now, for example, Amarok and Firefox (with extension) can do this. But although I have tried kdocker before, I never could get this working for other programs.

Maybe it won't do that??

Unknown said...

@Dulwhite: I just installed it, and it does minise apps to the tray. It's even the default setting, as far as I can mke out. If you do not want this, you can uncheck "Iconify when minimized" in the menu.