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

workarounds for crippled desktop environments without a system tray (ie: gnome3) #476

Open
totaam opened this issue Dec 18, 2013 · 15 comments
Milestone

Comments

@totaam
Copy link
Collaborator

totaam commented Dec 18, 2013

On those desktop environments, we have no way of interacting with the xpra client controls...

r4969 allows us to show the "session-info" window using "Meta+Shift+F11", which helps a little, but we have no way of toggling any of the settings usually found in the system tray.

We could:

  • add controls to the session info window to toggle those settings
  • add a control window which would be shown when running in a crippled desktop environment (ie: gnome3) - problem is that I am not aware of a way of detecting when the system tray is available or when it isn't... another gnome3 fail, reminiscent of the ubuntu failures in the same area.
@totaam
Copy link
Collaborator Author

totaam commented Aug 19, 2014

Related to #508 and #472.

See also #657

Looking at the API: gtk-application-set-app-menu, it looks like we need to port to GTK3 first (#90). Sigh.
https://mail.gnome.org/archives/commits-list/2012-January/msg08239.html

Example code? mini-dbusmenu

Or maybe we can just write ctypes / cython code for it?

@totaam
Copy link
Collaborator Author

totaam commented Sep 6, 2014

2014-09-06 16:49:02: antoine uploaded file global-menu.patch (1.1 KiB)

cython file for linking with libdbusmenu

@totaam
Copy link
Collaborator Author

totaam commented Sep 10, 2014

2014-09-10 15:56:29: totaam uploaded file dbusmenu.patch (5.8 KiB)

only a small portion of the headers... and far too many functions already

@totaam
Copy link
Collaborator Author

totaam commented Sep 17, 2015

2015-09-17 17:09:32: antoine commented


This is what I see for an terminal under Fedora:

$ xprop | grep _GTK_
_GTK_APP_MENU_OBJECT_PATH(UTF8_STRING) = "/org/gnome/Terminal/menus/appmenu"
_GTK_WINDOW_OBJECT_PATH(UTF8_STRING) = "/org/gnome/Terminal/window/1"
_GTK_APPLICATION_OBJECT_PATH(UTF8_STRING) = "/org/gnome/Terminal"
_GTK_UNIQUE_BUS_NAME(UTF8_STRING) = ":1.51"
_GTK_APPLICATION_ID(UTF8_STRING) = "org.gnome.Terminal"
$ qdbus org.gnome.Terminal /org/gnome/Terminal
method QDBusVariant org.freedesktop.DBus.Properties.Get(QString interface_name, QString property_name)
method QVariantMap org.freedesktop.DBus.Properties.GetAll(QString interface_name)
signal void org.freedesktop.DBus.Properties.PropertiesChanged(QString interface_name, QVariantMap changed_properties, QStringList invalidated_properties)
method void org.freedesktop.DBus.Properties.Set(QString interface_name, QString property_name, QDBusVariant value)
method QString org.freedesktop.DBus.Introspectable.Introspect()
method QString org.freedesktop.DBus.Peer.GetMachineId()
method void org.freedesktop.DBus.Peer.Ping()
method QDBusRawType::a{oa{sa{sv``` org.freedesktop.DBus.ObjectManager.GetManagedObjects()
signal void org.freedesktop.DBus.ObjectManager.InterfacesAdded(QDBusObjectPath object_path, QDBusRawType::a{sa{sv}} interfaces_and_properties)
signal void org.freedesktop.DBus.ObjectManager.InterfacesRemoved(QDBusObjectPath object_path, QStringList interfaces)
method void org.gtk.Actions.Activate(QString action_name, QVariantList parameter, QVariantMap platform_data)
signal void org.gtk.Actions.Changed(QStringList removals, QDBusRawType::a{sb} enable_changes, QVariantMap state_changes, QDBusRawType::a{s(bgav additions)
method QDBusRawType::(bgav) org.gtk.Actions.Describe(QString action_name)
method QDBusRawType::a{s(bgav)} org.gtk.Actions.DescribeAll()
method QStringList org.gtk.Actions.List()
method void org.gtk.Actions.SetState(QString action_name, QDBusVariant value, QVariantMap platform_data)
method void org.freedesktop.Application.Activate(QVariantMap platform-data)
method void org.freedesktop.Application.ActivateAction(QString action-name, QVariantList parameter, QVariantMap platform-data)
method void org.freedesktop.Application.Open(QStringList uris, QVariantMap platform-data)
property read bool org.gtk.Application.Busy
method void org.gtk.Application.Activate(QVariantMap platform-data)
method int org.gtk.Application.CommandLine(QDBusObjectPath path, QDBusRawType::aay arguments, QVariantMap platform-data)
method void org.gtk.Application.Open(QStringList uris, QString hint, QVariantMap platform-data)
}}}

Not sure if we want to call dbus from an X11 event callback... this could be asking for trouble.

@totaam
Copy link
Collaborator Author

totaam commented Sep 19, 2015

2015-09-19 15:26:06: antoine uploaded file gtk-menus.patch (5.6 KiB)

stub for adding gtk menus as a window property we can export

@totaam
Copy link
Collaborator Author

totaam commented Sep 19, 2015

If we want to integrate some form of OS global menu, be it Gnome's, Ubuntu's (#472), OSX'x or even just the MS Windows taskbar (#508), we need to define an API - this one seems to be the broadest and most generic one to use as a base.

The example code added in r10666 (improved in r10672) is enough to query a gtk application's global menu.

What needs to be done:

  • pure python dbus / x11 code to publish this menu client side (as GTK3 is still a long way off - see Python3 GTK3 client feature parity #640)
  • code to forward the dbus actions to the server - we already have a dbus proxy feature... but this may warrant using a more abstracted protocol on top of that: we don't want to be dealing with bus names and object paths when we already have the window id (which we can use to retrieve all those things) - we should only pass the actions to the client side (not all the dbus cruft)

Hopefully, we can make the code generic enough to be re-used for #904.

Links:

@totaam
Copy link
Collaborator Author

totaam commented Sep 29, 2015

Mostly implemented in r10702.

Still TODO:

  • when the application already has a menu, we need to merge our one into it somehow... tricky, and when the data isn't correct gnome-shell either crashes or doesn't do anything!
  • when we use our own default menu (as with an xterm), we probably want a few more entries, or maybe a link to a dialog to change the settings normally accessible from the system tray

@totaam
Copy link
Collaborator Author

totaam commented Oct 3, 2015

2015-10-03 10:04:49: antoine uploaded file expose-menubar-path.patch (1.6 KiB)

not sure what this is for - but it is referenced in some of the docs

@totaam
Copy link
Collaborator Author

totaam commented Oct 3, 2015

2015-10-03 10:06:41: antoine uploaded file global-menu-multiwindow.patch (26.9 KiB)

trying to make multi window mode more reliable (and failing)

@totaam
Copy link
Collaborator Author

totaam commented Oct 3, 2015

Found more undocumented features in parsing the source of mutter:

  • _GTK_MENUBAR_OBJECT_PATH see patch above to expose it
  • _GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED - which we may also want to sync?
  • _GTK_FRAME_EXTENTS - how does that differ from regular frame extents??

Might be related: gtk2's setup_toplevel_window uses a single leader window for all its windows (see ICCCM Session Management), and maybe we want a different leader for each application? (this is different from the ICCCM Group Leader stuff!)

@totaam
Copy link
Collaborator Author

totaam commented Nov 13, 2015

Note: this sort of works in 0.16, but only OSX clients will actually be able to show the forwarded menu.

@totaam
Copy link
Collaborator Author

totaam commented Apr 1, 2019

Maybe we can write an extension, at least for xpra's own tray.
Example of a simple extension: https://github.com/JasonLG1979/gnome-shell-extensions-morphine (Javascript - shudder)

@totaam
Copy link
Collaborator Author

totaam commented Jul 22, 2019

More details on the Linux desktop tray icon pain in #2161

@totaam
Copy link
Collaborator Author

totaam commented Sep 21, 2019

Writing Gnome Shell Extensions

And as far as I can tell, extensions aren't enabled by default..

@totaam
Copy link
Collaborator Author

totaam commented Oct 22, 2019

Similar request here: Detecting if TopIcons-Plus is active: dconf /org/gnome/shell/ .... 'TopIcons@phocean.net' ....

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

No branches or pull requests

1 participant