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.


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;

I have found a better solution here: https://wiki.ubuntu.com/MenuBar#Advertising_the_presence_of_the_menu_bar.


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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