Take the 2-minute tour ×

Is it possible to check from the application if its menu will be displayed in the window or in the panel (AppMenu)?

I can of course check if the environment is Unity, but some people use AppMenu in KDE or in classic GNOME, so I'm looking for more universal way.

I'll prefer a way suitable for C language and working in Ubuntu 11.10.

share|improve this question
add comment

3 Answers

I'm not sure how to check for the Qt module specifically. To look for the GTK module you can look for the environment variable UBUNTU_MENUPROXY. If you want to ensure that menus appear in the applications (and are exported if possible) then you can set APPMENU_DISPLAY_BOTH to 1. If you want to see if the indicator-appmenu host is taking menus you can look for the well-known-name "com.canonical.AppMenu.Registrar" on DBus. If it exists, it is hosting menus.

share|improve this answer
add comment

Here's a more complete answer that works from any Linux distro:

static int menu_proxy = -1;
typedef void *(*KVoidPtoF)();

void *proxylib;
KVoidPtoF gtk_menu_proxy_get;

menu_proxy = 0;
proxylib = dlopen("libappmenu.so", RTLD_NOLOAD | RTLD_LAZY);
if (proxylib)
    gtk_menu_proxy_get = (KVoidPtoF)dlsym(proxylib, 
    if (gtk_menu_proxy_get && (*gtk_menu_proxy_get)() != 0)
        menu_proxy = 1;
share|improve this answer
add comment

Your Answer


