def get_native_tray_classes(): #could restrict to only DEs that have a broken system tray like "GNOME Shell"? if has_gtk_menu_support(): #and wm_name=="GNOME Shell": try: from xpra.platform.xposix.gtkmenu_tray import GTKMenuTray traylog("using GTKMenuTray for '%s' window manager", get_wm_name() or "unknown") return [GTKMenuTray] except Exception as e: traylog("cannot load gtk menu tray: %s", e) return get_native_system_tray_classes()
def has_gtk_menu_support(): global _has_gtk_menu_support if not GTK_MENUS: _has_gtk_menu_support = False if _has_gtk_menu_support is not None: return _has_gtk_menu_support try: from xpra.gtk_common.gtk_util import get_default_root_window from xpra.x11.dbus.menu import has_gtk_menu_support root = get_default_root_window() _has_gtk_menu_support = has_gtk_menu_support(root) menulog("has_gtk_menu_support(%s)=%s", root, _has_gtk_menu_support) except Exception as e: menulog("cannot enable gtk-x11 menu support: %s", e) _has_gtk_menu_support = False return _has_gtk_menu_support
def get_native_tray_classes(): wm_name = os.environ.get("XDG_CURRENT_DESKTOP", "") try: wm_check = _get_X11_root_property("_NET_SUPPORTING_WM_CHECK", "WINDOW") if wm_check: xid = struct.unpack("=I", wm_check)[0] traylog("_NET_SUPPORTING_WM_CHECK window=%#x", xid) wm_name = _get_X11_window_property(xid, "_NET_WM_NAME", "UTF8_STRING") traylog("_NET_WM_NAME=%s", wm_name) except Exception as e: traylog.error("Error accessing window manager information:") traylog.error(" %s", e) #could restrict to only DEs that have a broken system tray like "GNOME Shell"? if has_gtk_menu_support(): #and wm_name=="GNOME Shell": try: from xpra.platform.xposix.gtkmenu_tray import GTKMenuTray traylog("using GTKMenuTray for %s", wm_name) return [GTKMenuTray] except Exception as e: traylog("cannot load gtk menu tray: %s", e) return get_native_system_tray_classes()
def get_menu_support_function(): if has_gtk_menu_support(): return _set_gtk_x11_window_menu return None