Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send ApplicationMenu data from server to client #228

Closed
totaam opened this issue Dec 25, 2012 · 26 comments
Closed

Send ApplicationMenu data from server to client #228

totaam opened this issue Dec 25, 2012 · 26 comments

Comments

@totaam
Copy link
Collaborator

totaam commented Dec 25, 2012

Issue migrated from trac ticket # 228

component: core | priority: major | resolution: fixed | keywords: ubuntu applicationmenu dbus app-menu

2012-12-25 19:53:44: Norman Rasmussen created the issue


OS: Ubuntu Precise with Unity desktop

Applications launched under xpra (eg: gedit), don't display any menu, and the global menu is empty.

Workaround: export UBUNTU_MENUPROXY= before running programs, to display menu within the app's window - not global though.

It would be nice to be able to proxy the menu back to the client, so that the menu is displayed correctly in the global menu bar.

Will probably require proxying a bunch of dbus calls back and forth,
re: https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationMenu

@totaam
Copy link
Collaborator Author

totaam commented Dec 26, 2012

2012-12-26 04:41:28: antoine changed priority from major to minor

@totaam
Copy link
Collaborator Author

totaam commented Dec 26, 2012

2012-12-26 04:41:28: antoine commented


Meh, once again this is a huge amount of work for very little benefit, I only hope the API is not as bad as the previous appindicator horror from Ubuntu (see #43).
Best link I've found so far: How to add support for the global menu to a python non-gtk, non-qt app? - all pointing to the toolkits, which we don't want to use since we want to act as the menu server, not a menu client..

The biggest obstacle: if we proxy the menu stuff, the client has to be able to handle it - and unless it is also an Ubuntu client sufficiently recent, it won't (unless we then write our own menu window for those clients - yuk). So we end up with applications that cannot be used unless one uses a specific recent version of Ubuntu with specific desktop settings - yuk!.
r2364 sets the UBUNTU_MENUPROXY="" environment variable. I may backport this, and add info in the FAQ.

Ultimately, I think this Ubuntu stuff is fundamentally broken if it enables global menus even when the window manager is not aware/cooperating. At the very least, it should check for a root window property to ensure that the global menus will work, and default to OFF unless the window manager sets it.

@totaam
Copy link
Collaborator Author

totaam commented Dec 26, 2012

2012-12-26 19:42:30: Norman Rasmussen commented


Yea, to do it 100% correctly there may have to be client side menu's - How does OS X present menu's? Are they shown in-window like X does? It would actually be nicer to be able to show them natively at the top.

I found two resources that have some information: The general ubuntu interface project called Ayatana, which has some design docs and debugging information (where I found the link in the descrption). There's a project called Arkose that has a dbus proxy as part of it.

Unfortunately the options range from simplest (disable appmenus), to brittle/os-dependant (dbus proxy that tweaks xwinid's), to full implementation (server and client have to completely re-implement menu's)

I've no illusions, this isn't an easy thing to fix, but it's nice to have it on the potential future roadmap.

@totaam
Copy link
Collaborator Author

totaam commented Dec 27, 2012

2012-12-27 05:04:35: antoine commented


OSX shows the application menu in the common location in the top bar, that's what Ubuntu tried to copy (amongst other things). So in this case, OSX could be made to work with the Ubuntu global menus. But that still leaves all the others - what to do with them? They may not have a top bar (I don't), or even no bars at all, so this would look extremely messy.

As for Ayatana/Arkose, as far as I can tell this is a dbus proxy, which is not what we want: we want to select dbus protocols individually and emulate the client/server whilst passing the messages to the other end (or not when none are connected). Which means custom code at each end for each and every dbus signal (and more).

@totaam
Copy link
Collaborator Author

totaam commented Feb 1, 2014

2014-02-01 08:09:39: antoine commented


MS Windows does have a place we could potentially use for this: the customizable taskbar, see #508.

See also (more Ubuntu specific workarounds needed): #472

For gnome3: #476

@totaam
Copy link
Collaborator Author

totaam commented Sep 25, 2015

2015-09-25 10:03:13: antoine changed priority from minor to major

@totaam
Copy link
Collaborator Author

totaam commented Sep 25, 2015

2015-09-25 10:03:13: antoine changed status from new to assigned

@totaam
Copy link
Collaborator Author

totaam commented Sep 25, 2015

2015-09-25 10:03:13: antoine commented


Probably makes sense to raise this so we can deal with #476 and #489.

In the case of GTK, we may need to be able to add our own menu(s) to the forwarded ones since the systray is unusable with gnome3.

r10679 improves on r10666 and allows us to extract all the menu and actions information into python data structures, then re-inject that at the other end.

@totaam
Copy link
Collaborator Author

totaam commented Sep 25, 2015

2015-09-25 15:11:53: antoine commented


r10680 has most the dbus bits required for querying and exposing gtk menus.

Still TODO:

  • deal with the tedious partial update API: we probably don't want to send this over the wire (far too specific to this gtk api), and just send the whole menu again instead then diff it instead (much easier and generic)
  • manage paths: add a prefix to all application-ids and paths? (so we don't conflict with the same application running locally) and deal with multiple instances: maybe this prefix has to be dynamic? (using the client pid or whatever)
  • add a new client capability for the application-grouping, another one for application menu?
  • probably add a new packet for adding (and removing?) application-groups (or whatever we decide to call it), updating their menus?
  • hooking up the new properties into the window model metadata, watching for changes, etc
  • look into overriding the group-leader code?
  • add command line options to enable / disable?
  • forward "Activate" actions to the server via the rpc code using a new rpc_types (maybe "menu-action" and "application-action"?) which just re-use the same dbus call_function code
  • makes sense to dynamically generate the environment when we start new commands, so that we can toggle UBUNTU_MENUPROXY based on whether the server and / or client support the application menu feature
  • if we don't have client-side support for "global menus" (ie: LXDE or KDE), then what do we do? disable the feature? create a window as anchor for the menu? (yuk!)

@totaam
Copy link
Collaborator Author

totaam commented Sep 27, 2015

2015-09-27 16:15:21: antoine uploaded file gtk-menu-forwarding.patch (25.9 KiB)

menu forwarding for gtk clients - still needs rpc code

@totaam
Copy link
Collaborator Author

totaam commented Sep 28, 2015

2015-09-28 11:33:17: antoine commented


Done for gtk menus in r10692.

Still TODO:

  • ubuntu's ApplicationMenu (aka "menuproxy" stuff) - which is very poorly documented from a developer's perspective - but their dbusmenu-dumper code may help, if I can find the source for it (libdbusmenu-tools?)
  • move the start / start-child code into the server so we can enable / disable the ubuntu menu proxy stuff (assuming we get it to work first..)
  • add our own tray entries to this menu? or maybe a single entry with a sub-menu? maybe only if there is no systray available (as is the case with gnome3 - belongs in workarounds for crippled desktop environments without a system tray (ie: gnome3) #476)
  • osx (no ticket exists for this platform): the problem here is that the menu api is difficult to work with: hardcoded default entries, must re-use the same instance, does not support disabled items? etc.. - and the big one: it is a shared instance for all windows, so we would need to trigger the menu changes ourselves when the focus goes to a different window!
  • win32: see MS Windows taskbar integration #508 (not possible without a huge amount of effort)

@totaam
Copy link
Collaborator Author

totaam commented Sep 30, 2015

2015-09-30 13:14:22: antoine commented


Ubuntu, two options:

The menu service might be easier to proxy for as the dbus interface seems relatively simple?

FWIW: dbusmenu-dumper doesn't work on Ubuntu 15.04. Yay.

@totaam
Copy link
Collaborator Author

totaam commented Oct 1, 2015

2015-10-01 13:44:22: antoine commented


Mostly done for OSX in r10705 (tiny fixups in r10706 and r10707), still TODO on osx:

  • "Quit" entries are a bit confusing... can we rename the main "Quit" menu item to "Disconnect" somehow? (most apps have their own "Quit" menu item which does actually quit..)
  • some of the "Xpra Options" menu entries don't work or don't show their submenus ("Info" is missing, etc) - the name of this menu could be improved too..
  • windows don't always get the "focus-in-event" so we fail to setup the right menu - we should add a more generic hook linked to the "focus" packet (which is more reliable)

@totaam
Copy link
Collaborator Author

totaam commented Oct 1, 2015

2015-10-01 18:19:56: antoine commented


More OSX updates:

@totaam
Copy link
Collaborator Author

totaam commented Oct 2, 2015

2015-10-02 06:18:23: antoine uploaded file gtkosxapplication_quartz.c (38.5 KiB)

patched gtkosx application file

@totaam
Copy link
Collaborator Author

totaam commented Oct 2, 2015

2015-10-02 06:48:24: antoine commented


More OSX updates:

  • "Quit" menu item: see patched file above
  • r10715: we now merge all our menus into the main menu using submenus, which frees up the space for the application forwarded menu - can be toggled back to using separate menus using XPRA_OSX_SINGLE_MENU=0 env var

@totaam
Copy link
Collaborator Author

totaam commented Oct 2, 2015

2015-10-02 08:25:07: antoine uploaded file menus-refcount.patch (17.7 KiB)

more proper reference counting for shared dbus menu services

@totaam
Copy link
Collaborator Author

totaam commented Nov 16, 2015

2015-11-16 08:04:04: antoine uploaded file osx-baobab-application-menu.png (61.6 KiB)

what this feature looks like with an osx client
osx-baobab-application-menu.png

@totaam
Copy link
Collaborator Author

totaam commented Nov 16, 2015

2015-11-16 08:05:50: antoine changed status from assigned to new

@totaam
Copy link
Collaborator Author

totaam commented Nov 16, 2015

2015-11-16 08:05:50: antoine changed owner from antoine to afarr

@totaam
Copy link
Collaborator Author

totaam commented Nov 16, 2015

2015-11-16 08:05:50: antoine commented


This will do for this release: we do send the application menu data to the client - which matches this ticket's summary.
It is only actually used client-side on OSX...

Will follow up in:

@afarr: this is mostly a FYI. You can test by running an application like baobab (and most GTK3 applications from gnome) and you should see this application's menu integrate into the OSX global menu (you may have to unfocus the window then focus it again to get the global menu to update on OSX... which is a bit focus-challenged):
[[Image(osx-baobab-application-menu.png)]]

Minor edit: r11245 strips the "on HOSTNAME" part from the menu bar entry.

@totaam
Copy link
Collaborator Author

totaam commented Dec 15, 2015

2015-12-15 00:50:53: afarr changed status from new to closed

@totaam
Copy link
Collaborator Author

totaam commented Dec 15, 2015

2015-12-15 00:50:53: afarr set resolution to fixed

@totaam
Copy link
Collaborator Author

totaam commented Dec 15, 2015

2015-12-15 00:50:53: afarr commented


Poked at this a little with the osx menu (and noticed the Disconnect Xpra in the menu, in place of quit... nicely managed).

Not sure if there's much else worth testing here, so I'll close, and search it out if I see issues in the future.

@totaam totaam closed this as completed Dec 15, 2015
@totaam
Copy link
Collaborator Author

totaam commented Jun 26, 2018

2018-06-26 15:07:21: antoine commented


And now they're abandoning it: GNOME Plans to Move App Menus Back Inside App Windows.
Worse still, all the menus will hang off the small "hamburger" button, how intuitive, not.

@totaam
Copy link
Collaborator Author

totaam commented Feb 21, 2019

2019-02-21 15:27:06: antoine commented


Or remove them altogether?? #2163

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant