customize your dolphin

If you have reached this page looking for ways to customize your pet dolphin and its aquarium, I am sorry to disappoint you, but this is a page about Dolphin the file manager.

Dolphin is the default file manager for the KDE desktop environment. It has many of the features that other file managers have, like multiple tabs, split-view, and drag and drop of files and folders.

But what makes it stand out, is a feature unique to Dolphin, called terminal view. Simply put, we can have a command line underneath the folder structure, which is always in the same path as the folder we are viewing. This allows us to run commands immediately, saving us the extra steps of having to open a separate instance of a terminal and painfully navigating to that directory first.

A command line underneath the folder structure. Genius!

The dolphin app store

Dolphin has a nice store-like page within its configuration menu, that can be used to browse and install add-ons. These are small programs that can add custom functionality to the application, usually through the addition of a new context item, which is the menu that shows up when we right click on a file or folder.

At first glance this sounds great. There are hundreds of add-ons in the store, covering most typical user needs such as compress, extract, share, backup, and more.

So what’s the problem?

The abundance of choice in the add-on store comes at a cost. Most of the add-ons have been uploaded by users, and the store does not guarantee their functionality or stability. Putting aside the obvious security concerns, add-ons often rely on other programs (called dependencies) to work. An add-on will not work if the dependencies it relies on do not already exist on our system.

This is almost always the case when Dolphin is installed on other desktop environments such as GNOME or Xfce. Since Dolphin is inherently a KDE application, most of the add-ons are made with that in mind, so they tend to use commands expected to exist in that system.

One such example is the dialog box. Any add-on that requires to get input from the user, or pop-up a message, has to use a command. KDE comes with kdialog. But kdialog does not exist in GNOME or Xfce, which both come with zenity. This breaks those add-ons, and unless we want to go chasing down and installing all those missing dependencies one by one, those add-ons will not work.

Dog.exe has stopped working.

Now what?

So downloading new functionality for our context menu from the dolphin app store is not guaranteed. We know we could use the command line to perform our action instead; dolphin puts it right underneath our file list. But we are already looking at the specific file or folder we want to process in the file explorer. There should be an easy way to do what we want by just clicking on it. It is right there!

No worries, creating a context menu in Dolphin is easy. All we have to do, is create a file in a special location. Dolphin will read its contents and create the context menu for us!

Let’s start. As an example, we’ll create a context menu which shows up when right clicking on a file, any file, then pops up a message showing the name of that file. Once we have that, it will be very easy to modify the script to do with that file anything we want.

A simple example

First we create the special folder in case it is not there already. The added option -p creates all folders in the given path as needed.

mkdir -p ~/.local/share/kio/servicemenus

Now for the special file. The name can be anything but we’ll give it a descriptive one so it can be easy to find.

touch show-me-the-filename.desktop

We also make it an executable.

chmod +x show-me-the-filename.desktop

And then we use our favorite text editor to put the text below in it.

[Desktop Entry]
Type=Service
MimeType=application/octet-stream;
Actions=showFilename;

[Desktop Action showFilename]
Icon=preview-file
Name=Show me the filename
Exec=zenity --info --title=Filename --text="$(basename %u)"

Done! Here is how our new context menu item looks when we right click on a file.

The context menu shows our new item.

When clicked, it shows a message using zenity, containing the filename of the file we right clicked.

A message using zenity, containing the filename of the file we right clicked.

You have probably already deduced that the most important line in that file is the last one, where we define the code that executes when we click on the menu item, and especially the %u variable which is used to pass the name of the file to our script.

We used zenity to display our message, but we can easily replace it with kdialog if it’s the one already installed in our system or we prefer it instead.

Exec=kdialog --title "Filename" --msgbox "$(basename %u)"

Message displayed using kdialog. Looking fancy.

A message using kdialog, containing the filename of the file we right clicked.

Much more to do

The item we created for our context menu is undeniably simple. Too simple! But it is the basis upon which we can build all kinds of custom functionality, tailored to our way of working with the file explorer. We can even change its icon, add sub-menus, or even make it show just when we click on images or folders.

To summarize, dolphin is a great file manager, not only because it has some unique and very useful features, but also because it is easily customizable across any desktop environment.

And if you came looking for ways to customize your pet dolphin but you stayed until the end, here is a picture of cute dolphin. You deserve it!

The cutest dolphin.