I'm looking for good documentation (an example, tutorial, or guide) on how to add global menu support to a non-gtk, non-qt application. (In gtk it works 'magically' for the main menu...). The toolkit I want to use this with is kivy, which supports the glib-mainloop (e.g. for gstreamer), so in principle all should work there.

I have seen the API reference of Dbusmenu and here, but that is not very helpful for understanding the mechanisms.

There is a short example for creating a launcher-quicklist which contains a dbus-menu, but not for the global-menu / appmenu.

There is a wiki page that does not contain any relevant information other then "Work on supporting other the application menu on other toolkits would be welcome, but not a priority for the DX team, help wanted."

There is a little information in this graphic from the indicator-appmenu source code, but its not enough, can not be found on developer.ubuntu.com and requires more explanation:

enter image description here


  • What is the procedure that gets a set of menu items (Dbusmenu.Menuitem) to be displayed?
  • What role does the client and the server play? (Which of those is supposed to be run in my application? Or both?)

Similar question

  • Maybe you can add the toolkit you are using.
    – Timo
    Jan 26, 2012 at 14:11
  • sure: it is the kivy toolkit.
    – xubuntix
    Jan 26, 2012 at 14:14
  • 1
    I think this question needs an answer from canonical.
    – Tachyons
    May 18, 2012 at 16:19
  • Initially I had hoped that the authors of dbusmenu-glib (e.g. Ted Gould), or even libdbusmenu-qt (Aurelien Gateau) could spend some of their time writing documentation of their code. But after 4 month of waiting, nothing happened. So I tried the second best option, trying to 'bribe' the community with a fiths of my reputation to step in. Seems that this does not work as well...
    – xubuntix
    May 18, 2012 at 18:26
  • @xubuntix suggest you contact Ted (gould.cx/ted/blog) and aurelien (agateau.com/about-me) directly
    – fossfreedom
    May 18, 2012 at 20:49

3 Answers 3


In general, I'd recommend using the toolkit supported ways to put menus in the global menubar... but, I'm assuming it's too late to convince you at this point :-) Also, I'll note that even thought we're using Dbusmenu and registration in 12.04 the goal is to move to GMenuModel and marking the window with its menus by 14.04, so this information will become dated. Ofcourse, the toolkit plug-ins will be updated ;-) (last time I'll try, I promise)

The basic principle involved is that we need to know what menus are associated with which window. We track the window using its XID and the menus are a path to the Dbusmenu Server on DBus. You'll need both of those pieces of information to register. The registration interface is pretty simple in that you basically pass both of those pieces of information to the registrar. The registrar's well known name on DBus is com.canonical.AppMenu.Registrar.

For an example of how this can work you can look at the mock-json-app sample code that is in indicator-appmenu. This is a small tool that will take the JSON file output by dbusmenu-dumper (which is in libdbusmenu-tools) and make a window that claims to have that menu. It also handles things like the appmenu crashing, which might not be really required for most application (though is really important in development :-) ).

To create a Dbusmenu Server you basically just need to allocate the object and tell it where to appear on DBus (so you can give the location to the registrar). For plugins like appmenu-gtk we use a generated path so that there is no conflict, but if you're controlling the app you can probably use a fixed path. Then you create a tree structure of Dbusmenu Menuitem objects. The root one isn't shown, but is passed to the Dbusmenu Server to start out the menus. The first level bellow the root will be shown as items across the Ubuntu Menubar.

Good luck, thanks to all the people who harassed me to answer this question. I still believe that you should use the toolkit support (I lied about it being the last time), but good luck!

  • 1
    Thank you very much! And thanks to all the people who harassed you :-) As to the toolkit question: I would love to use the toolkit support, but there is none for Kivy. And I will not switch toolkits just for the menu... Will the switch to GMenuModel make it impossible to use it with other toolkits?
    – xubuntix
    May 20, 2012 at 18:03
  • GMenuModel will make it easier to upstream in many toolkits as the support is in GLib directly so there isn't an additional dependency, which bothered some toolkit maintainers.
    – Ted Gould
    May 20, 2012 at 18:05
  • @TedGould Great answer, Ted! However, is there a GTK-less example? Something that's as close to using only Xlib as possible, and nothing else? The mock-json-app example you gave is great, if one uses Gtk; not so much if X11 is directly used (or another toolkit). I'm trying to put together something that uses only Glib, libdbusmenu-glib and X11, but it looks like I'm running into trouble. My goals? I'm interested in adding support in an SDL app, and I'm constantly thinking about GNUstep apps not having support for dbusmenu. Jun 9, 2012 at 13:04
  • 1
    @TedGould My attempt is over here: bitbucket.org/ivucica/minidbus-menu Hopefully you (or someone else!) will have a few minutes to take a look at the code and see why the menu doesn't appear, and why the titlebar says "Hud". :-) Jun 9, 2012 at 16:15
  • Looks like I got my C code to work under 12.04. I should have not tried to add standalone items to the menu; having added them as subitems of another menu item, it now works. Cool ;) Jun 24, 2013 at 13:39

Unfortunately, you will not find a friendly document for that. The global menu was developed with GTK and Qt in mind and, while it is theoretically possible to implement support for other webkits since the protocol is DBus-based, there was very little effort in making documentation available.

The best pointers I can give you are the source codes of indicator-appmenu and plasma-widget-menubar. You can read those to understand how the dbus protocol works.

  • 1
    Might it also help to get a dbus-monitor trace of the conversation for some representative cases? I don't know enough about dbusmenu or monitoring dbus to know, but I'd love to see some examples from someone that does.
    – nealmcb
    Mar 26, 2012 at 1:24

You can use python-dbus bindings, and use the API documented at http://developer.ubuntu.com/api/ubuntu-12.04/python/Dbusmenu-0.4.html for DbusMenu, to integrate with the global menu bar.

  • 4
    this is exactly the link I gave in my answer, stating that I do not understand how to use it!
    – xubuntix
    May 18, 2012 at 16:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .