Sub-menus in KDE 4 panels and desktops are back

The main openSUSE users' mailing list are a demanding bunch who know what they want. Over the last few months the KDE group have been asking them what they still miss from KDE 3 in KDE 4, and one of those things has been the ability to add a submenu of the main app launcher, whether Kickoff or traditional, to the panel as a button in its own right.

I thought Chani's recent blog about a generic app menu dataengine for KDE 4 could be useful in reimplementing this feature, so I sat down for a quick Friday afternoon hack. However, after a while I realised that I could do better than just hacking up another menu applet implementation. I realised that we already have all the code needed for building the menu tree, drawing the menu, handling the clicks, and configuring the menu in the existing launcher menus ('start buttons'). Looking at the code, it just came down to changing the point in the menu used for the menu's root. So I added a way to enable the context menu for submenus, identify the path of the submenu, then tell the panel or the desktop to add a new 'simplelauncher' applet using the original submenu as the menu root. The changes were only a few lines of code to the existing applets so we have a nice minimal yet fully-featured solution.

That didn't take too long so I even had time to make a movie:

OGG Theora version

movie of adding a submenu

Flash version


that's awesome! great work! ☺

By ehamberg at Mon, 08/24/2009 - 19:47

Very nice. I'll certainly use it.

A few feature requests. Ignore if already implemented:
- Add drag'n'drop support (I believe plasma uses a special mimetype?)
- Separate menu creation of all the items in kickoff. i.e. also for favorites, computer, recent and shutdown.

And again: great work.

By stecchino at Thu, 08/27/2009 - 10:46