Making KDE Play Nice on a GNOME Desktop

I prefer GNOME for the most part, but some KDE applications are simply better than their GNOME counterparts. That said, there are some problems getting them to work well together. I recently discovered that installing k3b cause my GNOME menus to, for lack of a better word, explode. Here’s how I went about fixing them.

First, to give you some idea of what I mean by explode, take a look at this:

KDE explosion in the GNOME menus
KDE explosion in the GNOME menus

All of that comes from installing k3b. The problem is that KDE doesn’t honor the freedesktop.org Desktop Menu Specification. Specifically, KDE should be putting OnlyShowIn entries into their .desktop files that shouldn’t be displayed in GNOME. This isn’t exactly a new problem. Given the fact that kicker bug #63933 was logged in 2003 and still isn’t fixed, I figured I’d have to fix it myself.

Here’s my solution. For each .desktop file in each package specified, this script will add OnlyShowIn=KDE if it isn’t already present.

#!/bin/bash

package_list="kamera kcontrol kdebase-data kdebase-kio-plugins \
              kdemultimedia-kio-plugins libkcddb1"

for package in $package_list; do
    for desktop_file in `dpkg -L $package | grep 'applications/.*\.desktop'`; do
        count=`grep -c -i OnlyShowIn $desktop_file`
        if [ $count -eq 0 ]; then
            echo "Modifying $package: $desktop_file"
            echo 'OnlyShowIn=KDE;' >> $desktop_file
        fi
    done
done

It needs to be run with sudo or as root since it’s modifying system files. Also, the list of packages I provided are not comprehensive. They’re simply the ones that I noticed didn’t honor the specification. If you aren’t using Debian or Ubuntu, you’ll have to modify the dpkg command to the equivalent rpm command.

Leave a Reply

Your email address will not be published.