a little KDE menus hack

I don’t like how KDE collapses menus of categories containing a single entry, as it does in openSUSE. It doesn’t make things clearer, and application links look pretty silly when represented with a directory icon. I could not find how to change that, neither in KDE settings nor in the freedesktop specs. I finally found a solution, which works halfway, as shown in the image.

  1. illustrates normal behaviour, as in Ubuntu (and others).
  2. is openSUSE menus collapsing (feature?).
  3. is how KDE menus look after I applied the following trick.

The trick consists of creating a dummy desktop file for a faked application (Exec=donothing) represented by a 1x1 transparent icon (Icon=blank.png) and adding it to all categories which contain a single menu entry. However the name could not be left empty, so I used a dot (you can see it in the image).

http://img43.imageshack.us/img43/5338/kdemenuhack.jpg


# cat /usr/local/share/applications/X_dummy.desktop
[Desktop Entry]
Name=. 
Comment=Dummy menu entry
Exec=donothing
Icon=blank.png
Terminal=false
Type=Application
StartupNotify=true
OnlyShowIn=KDE
Categories=X-Administration-Gnome-Personal;X-Administration-Gnome-System-gdm;X-Administration-Kde-Desktop;X-Communication-Chat-Gnome;X-Applications-Programming-Python;X-Applications-DTP;
# comment out the following line to collapse menus (openSUSE default)
#Hidden=true

I know, it’s a quick and dirty hack. It would be better to simply disable menus collapsing but I couldn’t figure out how. The desired behaviour is the one shown in picture 1.

You need to make it bring up a dialogue box saying “Congratulations! You’ve won!” if you manage to click on it…

:wink:

Could be easily done by replacing the Exec line in the X_dummy.desktop example with


Exec=kdialog --msgbox "Congratulation! You've won!"

I guess, I’ll keep it.

:wink:

i wonder if you can use a hard space (shift+ space) for the filename? that way it would be blank. :wink:

Is this not the same as right clicking the application launcher, then choosing Application Launcher Menu Settings, then under options uncheck Reduce Menu Depth? (At least if you’re using the classic style as in your screen shots, otherwise with the kickoff style it’s on the first screen of the dialog box).

Take Care,

Ian