Short KDE Toolbar Texts

If you use text under or alongside your toolbar icons, you might have the desire to change some of the texts to make them shorter, especially if you do not use english language texts. This tutorial describes the steps needed for KDE 4 applications. As an example, the goal is to change the text “Compare Files” to “Diff” in the Dolphin toolbar.

Dolphin toolbar with long icon text

Step 1: Make sure the application uses “appnameui.rc”

Usually if an application allows editing the toolbars, it saves its custom configuration to a file ending in “ui.rc” in the .kde/share/apps/appname/ directory. To find out if an application really uses this file, simply change the toolbar of that application using the “Configure Toolbars …” dialog, and check if said file exists. For Dolphin, the file is .kde/share/apps/dolphin/dolphinui.rc

Note: This step might crash with some applications (bug reports are already filed). The configuration file is usually still saved correctly.

Step 2: Select the action that you want to edit

Change the icon of the toolbar action that you would like to change the text on. This is only required to get the proper “Action” entry generated in the ui.rc file. There is a “Change Icon …” button in the toolbar dialog that opens the icon selector. For this example, I changed the icon for the “Compare Files” action to the “edit-copy” icon.

Dolphin's “Configure Toolbar ...” dialog

Step 3: Change the ui.rc file using a text editor

Load the ui.rc file in a text editor. It is an XML file. Near the end of the file there is an <ActionProperties> tag. Inside this tag all modified actions appear:

 <ActionProperties scheme="Default">
  <Action icon="edit-copy" name="compare_files"/>
 </ActionProperties>

Now delete the “icon” property and replace it with the “iconText” property:

 <ActionProperties scheme="Default">
  <Action iconText="Diff" name="compare_files"/>
 </ActionProperties>

Save the file. This will do two things if you restart Dolphin: you get the original icon back, and the icon text is changed from “Compare File” to “Diff”.

Dolphin toolbar with short icon text

Of course a real improvement would be if translators could simply provide two translations for the action texts, but KDE cannot handle it right now without the developer providing two translatable strings in the first place. I am currently investigating a solution for KDE 4.4, that does not add burden to translators or developers, and works with existing applications transparently. If I fail, I will add text customization from the toolbar edit GUI, as shown in the screen shot.