Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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("", 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
up vote 1 down vote accepted

I have found a better solution here:

share|improve this answer

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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.