Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Ubuntu Unity global menu in GTK#?

I'm developing a simple GTK# application(nothing serious, just a little project), and I've noticed my application menu bar is showing in my application window instead of Ubuntu's Unity global menu bar.

Is there any way to make the menu bar show up in the unity menu bar? I've tried to google a bit but most results seem to be about disabling this behavior - I want to enable it.

Currently, I'm adding the menu bar to a VBox, via MonoDevelop's visual editor.

like image 874
luiscubal Avatar asked Nov 24 '11 16:11

luiscubal


People also ask

What is global menu Linux?

The global menu is a mechanism, based on the Macintosh idea, of placing an application's menu in the top panel of the desktop, rather than with the application window. You need to focus an application, and then move the mouse to the top of the desktop to access the menus.

What is global menu bar?

Global menu bar: A concept in user interface design where a system-wide widget on the screen displays the menu items (also known as “actions” in Qt) for all applications.


1 Answers

Somehow, the application works fine without any changes.

My menubar is in a vbox which is the only child of the main window I created. It is the first element of the vbox, not sure if that affects anything.

And here's what I noticed:

I asked this question because when I clicked "Run" on MonoDevelop, the menu bar showed up in the window instead of being global.

However, when I run it directly from the command-line mono [myappname].exe, it works just fine. Not sure what's going on here.

So apparently the Unity devs made it easy to use the global menu bar automatically, but somehow MonoDevelop does something that disables this behavior when the app is run from MD. Not sure if it is a bug of MD, expected behavior or if there's some gotcha going on here.

Since the application is only run from MD for testing purposes, I'm accepting it the way it is now.

like image 109
luiscubal Avatar answered Sep 20 '22 23:09

luiscubal