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

Make Chrome work with the global menu #29

Closed
probonopd opened this issue Dec 25, 2020 · 38 comments
Closed

Make Chrome work with the global menu #29

probonopd opened this issue Dec 25, 2020 · 38 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@probonopd
Copy link
Member

probonopd commented Dec 25, 2020

Chrome does not show its menus in the global menu bar. Why?

In Chrome 12 https://www.omgubuntu.co.uk/2011/06/chrome-12-brings-unity-global-menu-support-and-heres-how-to-enable-it they added:

"Experimental GNOME menu bar support."

We need to figure out what happened to it and how to make it work.

@probonopd
Copy link
Member Author

probonopd commented Dec 25, 2020

The issue may have to do with the fact that WM_CLIENT_LEADER is not available for Chrome windows:

xprop | grep WM_CLIENT_LEADER and click on a Chrome window. Nothing!

And none of these either: _GTK_MENUBAR_OBJECT_PATH, _GTK_APP_MENU_OBJECT_PATH, _UNITY_OBJECT_PATH.

Are these documented somewhere?

But things do get published on D-Bus by Chrome:

org/appmenu/gtk/window/0

com/canonical/menu/600001

So something seems to be half-broken?

A Gtk application with working menu has:

xprop | grep MENU
_KDE_NET_WM_APPMENU_OBJECT_PATH(STRING) = "/MenuBar/2"
_KDE_NET_WM_APPMENU_SERVICE_NAME(STRING) = "org.kde.plasma.gmenu_dbusmenu_proxy"
_GTK_MENUBAR_OBJECT_PATH(UTF8_STRING) = "/org/appmenu/gtk/window/0"

I am not sure how exactly the KDE stuff ends up there, but I do notice the presence of _GTK_MENUBAR_OBJECT_PATH which is missing in Chrome windows.

@probonopd
Copy link
Member Author

Here is the code that

// Controls the Mac style menu bar on Linux desktop environments.
//
// Unity had a MacOS-like menu bar at the top of the screen that changed
// depending on the active window. Unity has been discontinued but the menu
// survived and is usually referred to as DBus AppMenu. There is support for it
// in KDE Plasma in form of a widget that can be inserted into a panel.

https://github.com/chromium/chromium/blob/master/chrome/browser/ui/views/frame/dbus_appmenu.h

@probonopd
Copy link
Member Author

probonopd commented Dec 25, 2020

grep -r _GTK_MENUBAR_OBJECT_PATH /usr/local/lib
Binary file /usr/local/lib/libgtk-3.so.0.2404.16 matches
Binary file /usr/local/lib/gtk-2.0/modules/libappmenu-gtk-module.so matches
Binary file /usr/local/lib/libgtk-3.so.0 matches
Binary file /usr/local/lib/libgtk-3.so matches
Binary file /usr/local/lib/gtk-3.0/modules/libappmenu-gtk-module.so matches

grep -r _GTK_MENUBAR_OBJECT_PATH /usr/local/bin
Binary file /usr/local/bin/gmenudbusmenuproxy matches

strings /usr/local/bin/gmenudbusmenuproxy | grep ^_
(...)
_GTK_UNIQUE_BUS_NAME
_GTK_APPLICATION_OBJECT_PATH
_UNITY_OBJECT_PATH
_GTK_WINDOW_OBJECT_PATH
_GTK_MENUBAR_OBJECT_PATH
_GTK_APP_MENU_OBJECT_PATH
_KDE_NET_WM_APPMENU_SERVICE_NAME
_KDE_NET_WM_APPMENU_OBJECT_PATH

I am not sure how exactly the KDE stuff ends up there, but I do notice the presence of _GTK_MENUBAR_OBJECT_PATH which is missing in Chrome windows.

Curent theory: Gtk applications are supposed to load libappmenu-gtk-module.so which is supposed to set _GTK_MENUBAR_OBJECT_PATH on the window which gmenudbusmenuproxy is supposed to convert to Qt/KDE-style menus (since Gtk and Qt and KDE do, as usual, not really agree on anything), and complement with _KDE_NET_WM_APPMENU_OBJECT_PATH?

@probonopd
Copy link
Member Author

probonopd commented Dec 25, 2020

LD_DEBUG=libs chrome 2>&1 | grep -i menu
lm_find("/usr/local/share/chromium/chrome", "/usr/local/lib/gtk-3.0/modules/libappmenu-gtk-module.so")
lml_find(0x8099ce110, "/usr/local/lib/gtk-3.0/modules/libappmenu-gtk-module.so")
loading "/usr/local/lib/gtk-3.0/modules/libappmenu-gtk-module.so"
/usr/local/lib/gtk-3.0/modules/libappmenu-gtk-module.so valid_hash_sysv 1 valid_hash_gnu 1 dynsymcount 122
  0x8139e1000 .. 0x8139ebfff: /usr/local/lib/gtk-3.0/modules/libappmenu-gtk-module.so
lm_find("/usr/local/lib/gtk-3.0/modules/libappmenu-gtk-module.so", "libappmenu-gtk3-parser.so.0")
lmp_find("/usr/local/lib/gtk-3.0/modules/libappmenu-gtk-module.so")
lml_find(0x8099ce110, "libappmenu-gtk3-parser.so.0")
 Searching for "libappmenu-gtk3-parser.so.0"
lm_find("/usr/local/lib/gtk-3.0/modules/libappmenu-gtk-module.so", "/usr/local/lib")
lmp_find("/usr/local/lib/gtk-3.0/modules/libappmenu-gtk-module.so")
  Trying "/usr/local/lib/libappmenu-gtk3-parser.so.0"
  Opened "/usr/local/lib/libappmenu-gtk3-parser.so.0", fd 34
loading "/usr/local/lib/libappmenu-gtk3-parser.so.0"
/usr/local/lib/libappmenu-gtk3-parser.so.0 valid_hash_sysv 1 valid_hash_gnu 1 dynsymcount 170
  0x814921000 .. 0x814935fff: /usr/local/lib/libappmenu-gtk3-parser.so.0
relocating "/usr/local/lib/gtk-3.0/modules/libappmenu-gtk-module.so"
relocating "/usr/local/lib/libappmenu-gtk3-parser.so.0"
calling init function for /usr/local/lib/libappmenu-gtk3-parser.so.0 at 0x8149324b8
calling init function for /usr/local/lib/gtk-3.0/modules/libappmenu-gtk-module.so at 0x8139e7ad8
"g_getenv" in "libappmenu-gtk-module.so" ==> 0x809ad7f80 in "libglib-2.0.so.0"
"gdk_display_get_default" in "libappmenu-gtk-module.so" ==> 0x80dc23c10 in "libgdk-3.so.0"
"gdk_x11_display_get_type" in "libappmenu-gtk-module.so" ==> 0x80dc54590 in "libgdk-3.so.0"
"g_ascii_strcasecmp" in "libappmenu-gtk-module.so" ==> 0x809b0e060 in "libglib-2.0.so.0"
"g_get_prgname" in "libappmenu-gtk-module.so" ==> 0x809b232e0 in "libglib-2.0.so.0"
"g_strcmp0" in "libappmenu-gtk-module.so" ==> 0x809b12b30 in "libglib-2.0.so.0"
"g_settings_new" in "libappmenu-gtk-module.so" ==> 0x80a8e7fb0 in "libgio-2.0.so.0"
"g_settings_get_value" in "libappmenu-gtk-module.so" ==> 0x80a8e8360 in "libgio-2.0.so.0"
"g_variant_type_checked_" in "libappmenu-gtk-module.so" ==> 0x809b34d80 in "libglib-2.0.so.0"
"g_variant_is_of_type" in "libappmenu-gtk-module.so" ==> 0x809b24450 in "libglib-2.0.so.0"
"g_variant_iter_init" in "libappmenu-gtk-module.so" ==> 0x809b25bd0 in "libglib-2.0.so.0"
"g_variant_iter_loop" in "libappmenu-gtk-module.so" ==> 0x809b2bcb0 in "libglib-2.0.so.0"
"g_object_unref" in "libappmenu-gtk-module.so" ==> 0x809b68b90 in "libgobject-2.0.so.0"
"g_variant_unref" in "libappmenu-gtk-module.so" ==> 0x809b2ce10 in "libglib-2.0.so.0"
"g_bus_get_sync" in "libappmenu-gtk-module.so" ==> 0x80a8911e0 in "libgio-2.0.so.0"
"g_dbus_connection_call_sync" in "libappmenu-gtk-module.so" ==> 0x80a8907f0 in "libgio-2.0.so.0"
"g_slice_free1" in "libdconfsettings.so" ==> 0x809b0b4b0 in "libglib-2.0.so.0""g_variant_get_child_value" in "libappmenu-gtk-module.so" ==> 0x809b2d470 in "libglib-2.0.so.0"
"g_variant_get" in "libappmenu-gtk-module.so" ==> 0x809b2b150 in "libglib-2.0.so.0"
"g_str_equal" in "libappmenu-gtk-module.so" ==> 0x809adcb80 in "libglib-2.0.so.0"
"g_variant_iter_free" in "libappmenu-gtk-module.so" ==> 0x809b28660 in "libglib-2.0.so.0"
"gtk_settings_get_default" in "libappmenu-gtk-module.so" ==> 0x80da5c0b0 in "libgtk-3.so.0"
"gtk_settings_get_type" in "libappmenu-gtk-module.so" ==> 0x80da5b690 in "libgtk-3.so.0"
"g_object_class_find_property" in "libappmenu-gtk-module.so" ==> 0x809b68600 in "libgobject-2.0.so.0"
"g_type_check_instance_is_fundamentally_a" in "libappmenu-gtk-module.so" ==> 0x809b813a0 in "libgobject-2.0.so.0"
"g_settings_get_boolean" in "libappmenu-gtk-module.so" ==> 0x80a8e9620 in "libgio-2.0.so.0"
"g_object_set" in "libappmenu-gtk-module.so" ==> 0x809b6b1d0 in "libgobject-2.0.so.0"
"g_bus_watch_name" in "libappmenu-gtk-module.so" ==> 0x80a89f000 in "libgio-2.0.so.0"
"unity_gtk_menu_shell_set_debug" in "libappmenu-gtk-module.so" ==> 0x81492d2f0 in "libappmenu-gtk3-parser.so.0"
"unity_gtk_action_group_set_debug" in "libappmenu-gtk-module.so" ==> 0x814929530 in "libappmenu-gtk3-parser.so.0"
"gtk_widget_get_type" in "libappmenu-gtk-module.so" ==> 0x80db1c7e0 in "libgtk-3.so.0"
"g_type_class_ref" in "libappmenu-gtk-module.so" ==> 0x809b7ca50 in "libgobject-2.0.so.0"
"gtk_application_window_get_type" in "libappmenu-gtk-module.so" ==> 0x80d889650 in "libgtk-3.so.0"
"gtk_window_get_type" in "libappmenu-gtk-module.so" ==> 0x80db36290 in "libgtk-3.so.0"
"g_type_children" in "libappmenu-gtk-module.so" ==> 0x809b80a10 in "libgobject-2.0.so.0"
"g_free" in "libappmenu-gtk-module.so" ==> 0x809af4b30 in "libglib-2.0.so.0"
"gtk_menu_bar_get_type" in "libappmenu-gtk-module.so" ==> 0x80d9d35c0 in "libgtk-3.so.0"
"gtk_widget_get_screen" in "libappmenu-gtk-module.so" ==> 0x80db24aa0 in "libgtk-3.so.0"
"gdk_screen_get_rgba_visual" in "libappmenu-gtk-module.so" ==> 0x80dc343a0 in "libgdk-3.so.0"
"g_type_check_instance_cast" in "libappmenu-gtk-module.so" ==> 0x809b814b0 in "libgobject-2.0.so.0"
"gtk_window_get_type_hint" in "libappmenu-gtk-module.so" ==> 0x80db39e60 in "libgtk-3.so.0"
"gdk_wayland_display_get_type" in "libappmenu-gtk-module.so" ==> 0x80dc88ac0 in "libgdk-3.so.0"
"g_type_check_instance_is_a" in "libappmenu-gtk-module.so" ==> 0x809b81200 in "libgobject-2.0.so.0"
"g_quark_from_static_string" in "libappmenu-gtk-module.so" ==> 0x809afdeb0 in "libglib-2.0.so.0"
"g_object_get_qdata" in "libappmenu-gtk-module.so" ==> 0x809b6c720 in "libgobject-2.0.so.0"
"g_strdup_printf" in "libappmenu-gtk-module.so" ==> 0x809b0d320 in "libglib-2.0.so.0"
"gtk_widget_get_window" in "libappmenu-gtk-module.so" ==> 0x80db2e730 in "libgtk-3.so.0"
"gdk_window_get_display" in "libappmenu-gtk-module.so" ==> 0x80dc381b0 in "libgdk-3.so.0"
"gdk_x11_display_get_xdisplay" in "libappmenu-gtk-module.so" ==> 0x80dc55fd0 in "libgdk-3.so.0"
"gdk_x11_window_get_xid" in "libappmenu-gtk-module.so" ==> 0x80dc6dfd0 in "libgdk-3.so.0"
"gdk_x11_get_xatom_by_name_for_display" in "libappmenu-gtk-module.so" ==> 0x80dc64d50 in "libgdk-3.so.0"
"XGetWindowProperty" in "libappmenu-gtk-module.so" ==> 0x80a4bf340 in "libX11.so.6"
"g_slice_alloc0" in "libappmenu-gtk-module.so" ==> 0x809b0b440 in "libglib-2.0.so.0"
"g_menu_new" in "libappmenu-gtk-module.so" ==> 0x80a87cda0 in "libgio-2.0.so.0"
"g_action_group_get_type" in "libappmenu-gtk-module.so" ==> 0x80a875170 in "libgio-2.0.so.0"
"unity_gtk_action_group_new" in "libappmenu-gtk-module.so" ==> 0x814928240 in "libappmenu-gtk3-parser.so.0"
"unity_gtk_action_group_get_type" in "libappmenu-gtk3-parser.so.0" ==> 0x814928090 in "libappmenu-gtk3-parser.so.0"
"g_once_init_enter" in "libappmenu-gtk3-parser.so.0" ==> 0x809b16ae0 in "libglib-2.0.so.0"
"g_intern_static_string" in "libappmenu-gtk3-parser.so.0" ==> 0x809afe020 in "libglib-2.0.so.0"
"g_type_register_static_simple" in "libappmenu-gtk3-parser.so.0" ==> 0x809b7e6a0 in "libgobject-2.0.so.0"
"g_action_group_get_type" in "libappmenu-gtk3-parser.so.0" ==> 0x80a875170 in "libgio-2.0.so.0"
"g_type_add_interface_static" in "libappmenu-gtk3-parser.so.0" ==> 0x809b7f040 in "libgobject-2.0.so.0"
"g_once_init_leave" in "libappmenu-gtk3-parser.so.0" ==> 0x809b16b90 in "libglib-2.0.so.0"
"g_object_new" in "libappmenu-gtk3-parser.so.0" ==> 0x809b69500 in "libgobject-2.0.so.0"
"g_type_class_peek_parent" in "libappmenu-gtk3-parser.so.0" ==> 0x809b7ffc0 in "libgobject-2.0.so.0"
"g_type_check_class_cast" in "libappmenu-gtk3-parser.so.0" ==> 0x809b817d0 in "libgobject-2.0.so.0"
"g_hash_table_new_full" in "libappmenu-gtk3-parser.so.0" ==> 0x809adafe0 in "libglib-2.0.so.0"
"g_menu_model_get_type" in "libappmenu-gtk-module.so" ==> 0x80a87b890 in "libgio-2.0.so.0"
"g_dbus_connection_export_menu_model" in "libappmenu-gtk-module.so" ==> 0x80a87e7c0 in "libgio-2.0.so.0"
"g_dbus_connection_export_action_group" in "libappmenu-gtk-module.so" ==> 0x80a877660 in "libgio-2.0.so.0"
"g_dbus_connection_get_unique_name" in "libappmenu-gtk-module.so" ==> 0x80a88e210 in "libgio-2.0.so.0"
"g_utf8_strlen" in "libappmenu-gtk-module.so" ==> 0x809b1e860 in "libglib-2.0.so.0"
"XChangeProperty" in "libappmenu-gtk-module.so" ==> 0x80a4b5530 in "libX11.so.6"
"g_object_set_qdata_full" in "libappmenu-gtk-module.so" ==> 0x809b6c930 in "libgobject-2.0.so.0"
calling fini function for /usr/local/lib/gtk-3.0/modules/libappmenu-gtk-module.so at 0x8139e7aec
"__cxa_finalize" in "libappmenu-gtk-module.so" ==> 0x80df84040 in "libc.so.7"
calling fini function for /usr/local/lib/libappmenu-gtk3-parser.so.0 at 0x8149324cc
"__cxa_finalize" in "libappmenu-gtk3-parser.so.0" ==> 0x80df84040 in "libc.so.7"

@probonopd
Copy link
Member Author

probonopd commented Dec 25, 2020

For comparison, here is a Gtk application where it works:

LD_DEBUG=libs system-config-printer 2>&1 | grep -i menu
lm_find("/usr/local/bin/python3.7", "/usr/local/lib/gtk-3.0/modules/libappmenu-gtk-module.so")
lml_find(0x80022d110, "/usr/local/lib/gtk-3.0/modules/libappmenu-gtk-module.so")
loading "/usr/local/lib/gtk-3.0/modules/libappmenu-gtk-module.so"
/usr/local/lib/gtk-3.0/modules/libappmenu-gtk-module.so valid_hash_sysv 1 valid_hash_gnu 1 dynsymcount 122
  0x8037e7000 .. 0x8037f1fff: /usr/local/lib/gtk-3.0/modules/libappmenu-gtk-module.so
lm_find("/usr/local/lib/gtk-3.0/modules/libappmenu-gtk-module.so", "libappmenu-gtk3-parser.so.0")
lmp_find("/usr/local/lib/gtk-3.0/modules/libappmenu-gtk-module.so")
lml_find(0x80022d110, "libappmenu-gtk3-parser.so.0")
 Searching for "libappmenu-gtk3-parser.so.0"
lm_find("/usr/local/lib/gtk-3.0/modules/libappmenu-gtk-module.so", "/usr/local/lib")
lmp_find("/usr/local/lib/gtk-3.0/modules/libappmenu-gtk-module.so")
  Trying "/usr/local/lib/libappmenu-gtk3-parser.so.0"
  Opened "/usr/local/lib/libappmenu-gtk3-parser.so.0", fd 6
loading "/usr/local/lib/libappmenu-gtk3-parser.so.0"
/usr/local/lib/libappmenu-gtk3-parser.so.0 valid_hash_sysv 1 valid_hash_gnu 1 dynsymcount 170
  0x8040d1000 .. 0x8040e5fff: /usr/local/lib/libappmenu-gtk3-parser.so.0
relocating "/usr/local/lib/gtk-3.0/modules/libappmenu-gtk-module.so"
relocating "/usr/local/lib/libappmenu-gtk3-parser.so.0"
calling init function for /usr/local/lib/libappmenu-gtk3-parser.so.0 at 0x8040e24b8
calling init function for /usr/local/lib/gtk-3.0/modules/libappmenu-gtk-module.so at 0x8037edad8
"g_getenv" in "libappmenu-gtk-module.so" ==> 0x801ac6f80 in "libglib-2.0.so.0"
"gdk_display_get_default" in "libappmenu-gtk-module.so" ==> 0x8021c7c10 in "libgdk-3.so.0"
"gdk_x11_display_get_type" in "libappmenu-gtk-module.so" ==> 0x8021f8590 in "libgdk-3.so.0"
"g_ascii_strcasecmp" in "libappmenu-gtk-module.so" ==> 0x801afd060 in "libglib-2.0.so.0"
"g_get_prgname" in "libappmenu-gtk-module.so" ==> 0x801b122e0 in "libglib-2.0.so.0"
"g_strcmp0" in "libappmenu-gtk-module.so" ==> 0x801b01b30 in "libglib-2.0.so.0"
"g_settings_new" in "libappmenu-gtk-module.so" ==> 0x801cbdfb0 in "libgio-2.0.so.0"
"g_settings_get_value" in "libappmenu-gtk-module.so" ==> 0x801cbe360 in "libgio-2.0.so.0""g_bus_get_sync" in "libdconfsettings.so" ==> 0x801c671e0 in "libgio-2.0.so.0"
"g_variant_type_checked_" in "libappmenu-gtk-module.so" ==> 0x801b23d80 in "libglib-2.0.so.0"reloc_jmpslot: *0x8007d10a8 = 0x8005f1c50
"g_variant_is_of_type" in "libappmenu-gtk-module.so" ==> 0x801b13450 in "libglib-2.0.so.0"
"g_variant_iter_init" in "libappmenu-gtk-module.so" ==> 0x801b14bd0 in "libglib-2.0.so.0"
"g_variant_iter_loop" in "libappmenu-gtk-module.so" ==> 0x801b1acb0 in "libglib-2.0.so.0"
"g_object_unref" in "libappmenu-gtk-module.so" ==> 0x8019e6b90 in "libgobject-2.0.so.0"
"g_variant_unref" in "libappmenu-gtk-module.so" ==> 0x801b1be10 in "libglib-2.0.so.0"
"g_bus_get_sync" in "libappmenu-gtk-module.so" ==> 0x801c671e0 in "libgio-2.0.so.0"
"g_signal_connect_data" in "libdconfsettings.so" ==> 0x8019f5480 in "libgobject-2.0.so.0""g_dbus_connection_call_sync" in "libappmenu-gtk-module.so" ==> 0x801c667f0 in "libgio-2.0.so.0"
"g_variant_get_child_value" in "libappmenu-gtk-module.so" ==> 0x801b1c470 in "libglib-2.0.so.0"
"g_variant_get" in "libappmenu-gtk-module.so" ==> 0x801b1a150 in "libglib-2.0.so.0"
"g_str_equal" in "libappmenu-gtk-module.so" ==> 0x801acbb80 in "libglib-2.0.so.0"
"g_variant_iter_free" in "libappmenu-gtk-module.so" ==> 0x801b17660 in "libglib-2.0.so.0"
"gtk_settings_get_default" in "libappmenu-gtk-module.so" ==> 0x803e5c0b0 in "libgtk-3.so.0"
"gtk_settings_get_type" in "libappmenu-gtk-module.so" ==> 0x803e5b690 in "libgtk-3.so.0"
"g_object_class_find_property" in "libappmenu-gtk-module.so" ==> 0x8019e6600 in "libgobject-2.0.so.0"
"g_type_check_instance_is_fundamentally_a" in "libappmenu-gtk-module.so" ==> 0x8019ff3a0 in "libgobject-2.0.so.0"
"g_settings_get_boolean" in "libappmenu-gtk-module.so" ==> 0x801cbf620 in "libgio-2.0.so.0"
"g_object_set" in "libappmenu-gtk-module.so" ==> 0x8019e91d0 in "libgobject-2.0.so.0"
"g_bus_watch_name" in "libappmenu-gtk-module.so" ==> 0x801c75000 in "libgio-2.0.so.0"
"unity_gtk_menu_shell_set_debug" in "libappmenu-gtk-module.so" ==> 0x8040dd2f0 in "libappmenu-gtk3-parser.so.0"
"unity_gtk_action_group_set_debug" in "libappmenu-gtk-module.so" ==> 0x8040d9530 in "libappmenu-gtk3-parser.so.0"
"gtk_widget_get_type" in "libappmenu-gtk-module.so" ==> 0x803f1c7e0 in "libgtk-3.so.0"
"g_type_class_ref" in "libappmenu-gtk-module.so" ==> 0x8019faa50 in "libgobject-2.0.so.0"
"gtk_application_window_get_type" in "libappmenu-gtk-module.so" ==> 0x803c89650 in "libgtk-3.so.0"
"gtk_window_get_type" in "libappmenu-gtk-module.so" ==> 0x803f36290 in "libgtk-3.so.0"
"g_type_children" in "libappmenu-gtk-module.so" ==> 0x8019fea10 in "libgobject-2.0.so.0"
"g_free" in "libappmenu-gtk-module.so" ==> 0x801ae3b30 in "libglib-2.0.so.0"
"gtk_menu_bar_get_type" in "libappmenu-gtk-module.so" ==> 0x803dd35c0 in "libgtk-3.so.0"
"g_menu_model_get_type" in "libgtk-3.so.0" ==> 0x801c51890 in "libgio-2.0.so.0"
"gtk_widget_get_screen" in "libappmenu-gtk-module.so" ==> 0x803f24aa0 in "libgtk-3.so.0"
"gdk_screen_get_rgba_visual" in "libappmenu-gtk-module.so" ==> 0x8021d83a0 in "libgdk-3.so.0"
"g_type_check_instance_cast" in "libappmenu-gtk-module.so" ==> 0x8019ff4b0 in "libgobject-2.0.so.0"
"gtk_window_get_type_hint" in "libappmenu-gtk-module.so" ==> 0x803f39e60 in "libgtk-3.so.0"
"gdk_wayland_display_get_type" in "libappmenu-gtk-module.so" ==> 0x80222cac0 in "libgdk-3.so.0"
"g_type_check_instance_is_a" in "libappmenu-gtk-module.so" ==> 0x8019ff200 in "libgobject-2.0.so.0"
"gtk_widget_get_settings" in "libappmenu-gtk-module.so" ==> 0x803f29970 in "libgtk-3.so.0"
"g_object_get" in "libappmenu-gtk-module.so" ==> 0x8019e92c0 in "libgobject-2.0.so.0"
"gtk_widget_get_window" in "libappmenu-gtk-module.so" ==> 0x803f2e730 in "libgtk-3.so.0"
"g_quark_from_static_string" in "libappmenu-gtk-module.so" ==> 0x801aeceb0 in "libglib-2.0.so.0"
"g_object_get_qdata" in "libappmenu-gtk-module.so" ==> 0x8019ea720 in "libgobject-2.0.so.0"
"g_strdup_printf" in "libappmenu-gtk-module.so" ==> 0x801afc320 in "libglib-2.0.so.0"
"gdk_window_get_display" in "libappmenu-gtk-module.so" ==> 0x8021dc1b0 in "libgdk-3.so.0"
"gdk_x11_display_get_xdisplay" in "libappmenu-gtk-module.so" ==> 0x8021f9fd0 in "libgdk-3.so.0"
"gdk_x11_window_get_xid" in "libappmenu-gtk-module.so" ==> 0x802211fd0 in "libgdk-3.so.0"
"gdk_x11_get_xatom_by_name_for_display" in "libappmenu-gtk-module.so" ==> 0x802208d50 in "libgdk-3.so.0"
"XGetWindowProperty" in "libappmenu-gtk-module.so" ==> 0x8024fe340 in "libX11.so.6"
"g_slice_alloc0" in "libappmenu-gtk-module.so" ==> 0x801afa440 in "libglib-2.0.so.0"
"g_menu_new" in "libappmenu-gtk-module.so" ==> 0x801c52da0 in "libgio-2.0.so.0"
"g_action_group_get_type" in "libappmenu-gtk-module.so" ==> 0x801c4b170 in "libgio-2.0.so.0"
"unity_gtk_action_group_new" in "libappmenu-gtk-module.so" ==> 0x8040d8240 in "libappmenu-gtk3-parser.so.0"
"unity_gtk_action_group_get_type" in "libappmenu-gtk3-parser.so.0" ==> 0x8040d8090 in "libappmenu-gtk3-parser.so.0"
"g_once_init_enter" in "libappmenu-gtk3-parser.so.0" ==> 0x801b05ae0 in "libglib-2.0.so.0"
"g_intern_static_string" in "libappmenu-gtk3-parser.so.0" ==> 0x801aed020 in "libglib-2.0.so.0"
"g_type_register_static_simple" in "libappmenu-gtk3-parser.so.0" ==> 0x8019fc6a0 in "libgobject-2.0.so.0"
"g_action_group_get_type" in "libappmenu-gtk3-parser.so.0" ==> 0x801c4b170 in "libgio-2.0.so.0"
"g_type_add_interface_static" in "libappmenu-gtk3-parser.so.0" ==> 0x8019fd040 in "libgobject-2.0.so.0"
"g_once_init_leave" in "libappmenu-gtk3-parser.so.0" ==> 0x801b05b90 in "libglib-2.0.so.0"
"g_object_new" in "libappmenu-gtk3-parser.so.0" ==> 0x8019e7500 in "libgobject-2.0.so.0"
"g_type_class_peek_parent" in "libappmenu-gtk3-parser.so.0" ==> 0x8019fdfc0 in "libgobject-2.0.so.0"
"g_type_check_class_cast" in "libappmenu-gtk3-parser.so.0" ==> 0x8019ff7d0 in "libgobject-2.0.so.0"
"g_hash_table_new_full" in "libappmenu-gtk3-parser.so.0" ==> 0x801ac9fe0 in "libglib-2.0.so.0"
"g_menu_model_get_type" in "libappmenu-gtk-module.so" ==> 0x801c51890 in "libgio-2.0.so.0"
"g_dbus_connection_export_menu_model" in "libappmenu-gtk-module.so" ==> 0x801c547c0 in "libgio-2.0.so.0"
"g_dbus_connection_export_action_group" in "libappmenu-gtk-module.so" ==> 0x801c4d660 in "libgio-2.0.so.0"
"g_dbus_connection_get_unique_name" in "libappmenu-gtk-module.so" ==> 0x801c64210 in "libgio-2.0.so.0"
"g_utf8_strlen" in "libappmenu-gtk-module.so" ==> 0x801b0d860 in "libglib-2.0.so.0"
"XChangeProperty" in "libappmenu-gtk-module.so" ==> 0x8024f4530 in "libX11.so.6"
"g_object_set_qdata_full" in "libappmenu-gtk-module.so" ==> 0x8019ea930 in "libgobject-2.0.so.0"
"gtk_widget_get_toplevel" in "libappmenu-gtk-module.so" ==> 0x803f2a480 in "libgtk-3.so.0"
"gtk_menu_shell_get_type" in "libappmenu-gtk-module.so" ==> 0x803ddadd0 in "libgtk-3.so.0"
"unity_gtk_menu_shell_new" in "libappmenu-gtk-module.so" ==> 0x8040db260 in "libappmenu-gtk3-parser.so.0"
"g_menu_model_get_type" in "libappmenu-gtk3-parser.so.0" ==> 0x801c51890 in "libgio-2.0.so.0"
"gtk_settings_get_default" in "libappmenu-gtk3-parser.so.0" ==> 0x803e5c0b0 in "libgtk-3.so.0"
"g_signal_connect_data" in "libappmenu-gtk3-parser.so.0" ==> 0x8019f5480 in "libgobject-2.0.so.0"
"g_object_get" in "libappmenu-gtk3-parser.so.0" ==> 0x8019e92c0 in "libgobject-2.0.so.0"
"g_type_check_instance_cast" in "libappmenu-gtk3-parser.so.0" ==> 0x8019ff4b0 in "libgobject-2.0.so.0"
"g_quark_from_static_string" in "libappmenu-gtk3-parser.so.0" ==> 0x801aeceb0 in "libglib-2.0.so.0"
"g_object_set_qdata_full" in "libappmenu-gtk3-parser.so.0" ==> 0x8019ea930 in "libgobject-2.0.so.0"
"unity_gtk_action_group_connect_shell" in "libappmenu-gtk-module.so" ==> 0x8040d8fd0 in "libappmenu-gtk3-parser.so.0"
"unity_gtk_menu_shell_get_type" in "libappmenu-gtk3-parser.so.0" ==> 0x8040db130 in "libappmenu-gtk3-parser.so.0"
"g_object_ref" in "libappmenu-gtk3-parser.so.0" ==> 0x8019e6a90 in "libgobject-2.0.so.0"
"g_menu_append_section" in "libappmenu-gtk-module.so" ==> 0x801c53110 in "libgio-2.0.so.0"
"g_slist_append" in "libappmenu-gtk-module.so" ==> 0x801afb610 in "libglib-2.0.so.0"
"g_signal_connect_data" in "libappmenu-gtk-module.so" ==> 0x8019f5480 in "libgobject-2.0.so.0"
"g_log" in "libappmenu-gtk-module.so" ==> 0x801ae4450 in "libglib-2.0.so.0"
"gtk_widget_queue_resize" in "libappmenu-gtk-module.so" ==> 0x803f20bf0 in "libgtk-3.so.0"
"g_hash_table_size" in "libappmenu-gtk3-parser.so.0" ==> 0x801acb940 in "libglib-2.0.so.0"
"g_malloc_n" in "libappmenu-gtk3-parser.so.0" ==> 0x801ae3bd0 in "libglib-2.0.so.0"
"g_hash_table_iter_init" in "libappmenu-gtk3-parser.so.0" ==> 0x801aca080 in "libglib-2.0.so.0"
"g_ptr_array_new_with_free_func" in "libappmenu-gtk3-parser.so.0" ==> 0x801aa8700 in "libglib-2.0.so.0"
"gtk_container_get_type" in "libappmenu-gtk3-parser.so.0" ==> 0x803ce0130 in "libgtk-3.so.0"
"gtk_container_get_children" in "libappmenu-gtk3-parser.so.0" ==> 0x803ce3700 in "libgtk-3.so.0"
"gtk_menu_item_get_submenu" in "libappmenu-gtk3-parser.so.0" ==> 0x803dd6d90 in "libgtk-3.so.0"
"g_signal_emit_by_name" in "libappmenu-gtk3-parser.so.0" ==> 0x8019f8c60 in "libgobject-2.0.so.0"
"gtk_menu_item_get_label" in "libappmenu-gtk3-parser.so.0" ==> 0x803dd7c10 in "libgtk-3.so.0"
"gtk_menu_item_get_type" in "libappmenu-gtk3-parser.so.0" ==> 0x803dd60e0 in "libgtk-3.so.0"
"gtk_label_get_type" in "libappmenu-gtk3-parser.so.0" ==> 0x803da9e40 in "libgtk-3.so.0"
"g_type_check_instance_is_fundamentally_a" in "libappmenu-gtk3-parser.so.0" ==> 0x8019ff3a0 in "libgobject-2.0.so.0"
"g_type_is_a" in "libappmenu-gtk3-parser.so.0" ==> 0x8019f9fe0 in "libgobject-2.0.so.0"
"g_type_check_instance_is_a" in "libappmenu-gtk3-parser.so.0" ==> 0x8019ff200 in "libgobject-2.0.so.0"
"gtk_container_forall" in "libappmenu-gtk3-parser.so.0" ==> 0x803ce3490 in "libgtk-3.so.0"
"g_ptr_array_add" in "libappmenu-gtk3-parser.so.0" ==> 0x801aa9080 in "libglib-2.0.so.0"
"g_list_free" in "libappmenu-gtk3-parser.so.0" ==> 0x801ad7ec0 in "libglib-2.0.so.0"
"g_sequence_new" in "libappmenu-gtk3-parser.so.0" ==> 0x801af5900 in "libglib-2.0.so.0"
"gtk_widget_get_type" in "libappmenu-gtk3-parser.so.0" ==> 0x803f1c7e0 in "libgtk-3.so.0"
"gtk_widget_get_visible" in "libappmenu-gtk3-parser.so.0" ==> 0x803f27110 in "libgtk-3.so.0"
"gtk_tearoff_menu_item_get_type" in "libappmenu-gtk3-parser.so.0" ==> 0x803c4c700 in "libgtk-3.so.0"
"g_sequence_append" in "libappmenu-gtk3-parser.so.0" ==> 0x801af5fc0 in "libglib-2.0.so.0"
"unity_gtk_action_group_connect_shell" in "libappmenu-gtk3-parser.so.0" ==> 0x8040d8fd0 in "libappmenu-gtk3-parser.so.0"
"g_sequence_get_begin_iter" in "libappmenu-gtk3-parser.so.0" ==> 0x801af5b80 in "libglib-2.0.so.0"
"g_sequence_iter_is_end" in "libappmenu-gtk3-parser.so.0" ==> 0x801af8350 in "libglib-2.0.so.0"
"g_sequence_get" in "libappmenu-gtk3-parser.so.0" ==> 0x801af8020 in "libglib-2.0.so.0"
"gtk_radio_menu_item_get_type" in "libappmenu-gtk3-parser.so.0" ==> 0x803e27850 in "libgtk-3.so.0"
"gtk_separator_menu_item_get_type" in "libappmenu-gtk3-parser.so.0" ==> 0x803e5aba0 in "libgtk-3.so.0"
"g_strdup" in "libappmenu-gtk3-parser.so.0" ==> 0x801afc150 in "libglib-2.0.so.0"
"g_hash_table_contains" in "libappmenu-gtk3-parser.so.0" ==> 0x801acafd0 in "libglib-2.0.so.0"
"g_free" in "libappmenu-gtk3-parser.so.0" ==> 0x801ae3b30 in "libglib-2.0.so.0"
"g_hash_table_insert" in "libappmenu-gtk3-parser.so.0" ==> 0x801acab40 in "libglib-2.0.so.0"
"g_action_group_action_added" in "libappmenu-gtk3-parser.so.0" ==> 0x801c4bd70 in "libgio-2.0.so.0"
"g_strdup_printf" in "libappmenu-gtk3-parser.so.0" ==> 0x801afc320 in "libglib-2.0.so.0"
"g_sequence_iter_next" in "libappmenu-gtk3-parser.so.0" ==> 0x801af84b0 in "libglib-2.0.so.0"
"g_sequence_get_length" in "libappmenu-gtk3-parser.so.0" ==> 0x801af8130 in "libglib-2.0.so.0"
"g_ptr_array_new_full" in "libappmenu-gtk3-parser.so.0" ==> 0x801aa8790 in "libglib-2.0.so.0"
"g_menu_model_get_n_items" in "libappmenu-gtk3-parser.so.0" ==> 0x801c51a60 in "libgio-2.0.so.0"
"g_sequence_get_iter_at_pos" in "libappmenu-gtk3-parser.so.0" ==> 0x801af8160 in "libglib-2.0.so.0"
"g_sequence_get_end_iter" in "libappmenu-gtk3-parser.so.0" ==> 0x801af5bd0 in "libglib-2.0.so.0"
"g_sequence_iter_get_position" in "libappmenu-gtk3-parser.so.0" ==> 0x801af8430 in "libglib-2.0.so.0"
"g_sequence_iter_move" in "libappmenu-gtk3-parser.so.0" ==> 0x801af8590 in "libglib-2.0.so.0"
"gtk_menu_shell_get_type" in "libappmenu-gtk3-parser.so.0" ==> 0x803ddadd0 in "libgtk-3.so.0"
"gtk_image_menu_item_get_type" in "libappmenu-gtk3-parser.so.0" ==> 0x803c34b60 in "libgtk-3.so.0"
"gtk_label_get_use_underline" in "libappmenu-gtk3-parser.so.0" ==> 0x803dae100 in "libgtk-3.so.0"
"gtk_image_get_type" in "libappmenu-gtk3-parser.so.0" ==> 0x803d9f2f0 in "libgtk-3.so.0"
"g_variant_new_string" in "libappmenu-gtk3-parser.so.0" ==> 0x801b151f0 in "libglib-2.0.so.0"
"g_variant_ref_sink" in "libappmenu-gtk3-parser.so.0" ==> 0x801b1bfe0 in "libglib-2.0.so.0"
"gtk_check_menu_item_get_type" in "libappmenu-gtk3-parser.so.0" ==> 0x803ccbe80 in "libgtk-3.so.0"
"gtk_menu_item_get_accel_path" in "libappmenu-gtk3-parser.so.0" ==> 0x803dd7aa0 in "libgtk-3.so.0"
"gtk_widget_list_accel_closures" in "libappmenu-gtk3-parser.so.0" ==> 0x803f23ed0 in "libgtk-3.so.0"
"gdk_window_move_resize" in "libappmenu-gtk-module.so" ==> 0x8021e4420 in "libgdk-3.so.0"
"g_hash_table_lookup" in "libappmenu-gtk3-parser.so.0" ==> 0x801aca840 in "libglib-2.0.so.0"
"g_strcmp0" in "libappmenu-gtk3-parser.so.0" ==> 0x801b01b30 in "libglib-2.0.so.0"
"g_variant_new_boolean" in "libappmenu-gtk3-parser.so.0" ==> 0x801b13350 in "libglib-2.0.so.0"
"gtk_widget_is_sensitive" in "libappmenu-gtk3-parser.so.0" ==> 0x803f242f0 in "libgtk-3.so.0"
"g_sequence_lookup" in "libappmenu-gtk3-parser.so.0" ==> 0x801af7ce0 in "libglib-2.0.so.0"
"gtk_image_menu_item_get_use_stock" in "libappmenu-gtk3-parser.so.0" ==> 0x803c35140 in "libgtk-3.so.0"
"gtk_accel_map_lookup_entry" in "libappmenu-gtk3-parser.so.0" ==> 0x803c7b7c0 in "libgtk-3.so.0"
"gtk_accelerator_name" in "libappmenu-gtk3-parser.so.0" ==> 0x803c78df0 in "libgtk-3.so.0"
"gtk_check_menu_item_get_draw_as_radio" in "libappmenu-gtk3-parser.so.0" ==> 0x803ccc650 in "libgtk-3.so.0"
"gtk_accel_group_from_accel_closure" in "libappmenu-gtk3-parser.so.0" ==> 0x803c78090 in "libgtk-3.so.0"
"gtk_accel_group_find" in "libappmenu-gtk3-parser.so.0" ==> 0x803c77d00 in "libgtk-3.so.0"
"gtk_check_menu_item_get_active" in "libappmenu-gtk3-parser.so.0" ==> 0x803ccc3b0 in "libgtk-3.so.0"
"g_param_spec_get_name" in "libappmenu-gtk3-parser.so.0" ==> 0x8019ec550 in "libgobject-2.0.so.0"
"g_intern_string" in "libappmenu-gtk3-parser.so.0" ==> 0x801aecfd0 in "libglib-2.0.so.0"
"g_sequence_search" in "libappmenu-gtk3-parser.so.0" ==> 0x801af79b0 in "libglib-2.0.so.0"
"g_sequence_iter_prev" in "libappmenu-gtk3-parser.so.0" ==> 0x801af8520 in "libglib-2.0.so.0"
"g_menu_model_items_changed" in "libappmenu-gtk3-parser.so.0" ==> 0x801c51bf0 in "libgio-2.0.so.0"

@probonopd
Copy link
Member Author

probonopd commented Dec 25, 2020

The source code of libappmenu-gtk-module.so is at https://github.com/rilian-la-te/vala-panel-appmenu/. From comparing the two cases above, it seems like with Chrome the last thing that happens is XChangeProperty in gtk_widget_set_x11_property_string, followed by g_object_set_qdata_full? So it all ends somewhere around here?

@probonopd
Copy link
Member Author

probonopd commented Dec 25, 2020

What is a "Unity Object Path", after all, is it the same as a "Gtk Menu Bar Object Path", and where is this documented?

@probonopd probonopd added bug Something isn't working help wanted Extra attention is needed labels Dec 25, 2020
@probonopd
Copy link
Member Author

probonopd commented Dec 25, 2020

Fwiw, Google Chrome does work with KDE Plasma's Global menu in KDE neon devedition...

image

@grahamperrin
Copy link

Suggestion: documentation

Either:

  1. link from https://github.com/helloSystem/hello/wiki/Status#what-does-not-work-yet to here; or
  2. reduce the need to maintain wiki pages – people can find their way to issues such as this through the https://github.com/helloSystem/hello#contributing direction to help wanted

@probonopd
Copy link
Member Author

https://github.com/helloSystem/hello/wiki/Status#what-does-not-work-yet should eventually give way to a proper changelog. What is the easiest way to maintain one?

@probonopd
Copy link
Member Author

probonopd commented Jan 2, 2021

Note that https://www.youtube.com/watch?v=Qe_guKtmIy0 shows Chrome with global menus using dde-globalmenu-service (not on FreeBSD though).

When killing helloSystem Menu and killing helloSystem gmenudbusmenuproxy and then running dde-globalmenu-service on helloSystem, you can see that it does interact with the menus of Gtk applications such as system-config-printer but not with those of Chromium. This leads me to suspect that it is something about the FreeBSD Chromium package that makes the global menus not work there? Maybe a build time option?

https://www.freshports.org/www/chromium says:

===> The following configuration options are available for chromium-87.0.4280.88:
     CODECS=on: Compile and enable patented codecs like H.264
     CUPS=on: CUPS printing system support
     DEBUG=off: Build with debugging support
     DRIVER=on: Install chromedriver
     KERBEROS=on: Kerberos support
     TEST=off: Build and/or run tests
====> Options available for the group AUDIO
     ALSA=off: ALSA audio architecture support
     PULSEAUDIO=off: PulseAudio sound server support
     SNDIO=on: Sndio audio support
===> Use 'make config' to modify these settings

Possibly this needs to be discussed with chromium@FreeBSD.org?

@probonopd
Copy link
Member Author

https://github.com/chromium/chromium/blob/master/chrome/browser/ui/views/frame/dbus_appmenu.cc suggests that there is/was global menu support in the Chromium source code.

How can it be activated?

https://github.com/chromium/chromium/blob/72ceeed2ebcd505b8d8205ed7354e862b871995e/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_linux.cc#L32-L47

Can it be as easy as enabling USE_DBUS_MENU in the FreeBSD Makefile?
That would be huge.

Possibly this needs to be discussed with chromium@FreeBSD.org?

@probonopd
Copy link
Member Author

probonopd commented Oct 31, 2021

@jsm222
Copy link

jsm222 commented Nov 1, 2021

Fwiw, Google Chrome does work with KDE Plasma's Global menu in KDE neon devedition...

image

Is this on FreeBSD? If it is then one is able to something with stock www/chromium. Also FWIW I tried to set use_dbus=true in the www/chromium Makefile with no effect. Perhaps it would be a plan to look into apps like evince and other app without a menubar. Or to dig down how kde did it, if they did it on FreeBSD

@probonopd
Copy link
Member Author

No, the screenshot is from a LInux distribution @jsm222:
https://neon.kde.org/

I tried to set use_dbus=true in the www/chromium Makefile with no effect

Looking at the Chromium source code, it seems to need USE_DBUS_MENU.

@jsm222
Copy link

jsm222 commented Nov 1, 2021

No, the screenshot is from a LInux distribution @jsm222: https://neon.kde.org/

I tried to set use_dbus=true in the www/chromium Makefile with no effect

Looking at the Chromium source code, it seems to need USE_DBUS_MENU.

Yes, but that is set to true if use_dbus is set true. It is not an config setting on its own afaict

@probonopd
Copy link
Member Author

Can you confirm that using use_dbus does result in a different binary? If so, it'd be nice if you could upload it somewhere for further analysis by me. Thanks!

@jsm222
Copy link

jsm222 commented Nov 1, 2021

FWIW
SHA1 (/var/cache/pkg/chromium-94.0.4606.81_1.pkg) = c27b9eb0b71d4e4141d192a6c50fac5f20116660 from Freebsd
$ sha1 /usr/local/poudriere/data/packages/13amd64-main/All/chromium-94.0.4606.81_1.pkg
SHA1 (/usr/local/poudriere/data/packages/13amd64-main/All/chromium-94.0.4606.81_1.pkg) = 5f6a2643f149026d9e50cc676994313bc18cb911

You should be able to download them from the repo described at https://wiki.freebsd.org/helloDesktop
where you replace $abi with 13amd64-main

@probonopd
Copy link
Member Author

probonopd commented Nov 1, 2021

Thanks @jsm222 unfortunately I can't run this on my FreeBSD 12.2 based system: getting Undefined symbol "rand@FBSD_1.6".

strings suggests there is at least some related code in there:

FreeBSD% strings ./usr/local/share/chromium/chrome | grep dbusmenu
/com/canonical/dbusmenu
com.canonical.dbusmenu

But the same is true for the "normal" chrome from the FreeBSD repo.

@jsm222
Copy link

jsm222 commented Nov 1, 2021

Oh, ok I just checked the sums of the binaries themselfs, they are the same. I think if the buildsystem detects dbus it sets use_dbus automatically. But I will double check.

@probonopd
Copy link
Member Author

probonopd commented Nov 1, 2021

Let's find out whether use_dbus really implies USE_DBUS_MENU.

@jsm222
Copy link

jsm222 commented Nov 1, 2021

@jsm222
Copy link

jsm222 commented Nov 1, 2021

With or without explicit setting of use_dbus=true defines becomes

    if (use_dbus && (use_x11 || ozone_platform_x11)) {
      sources += [
        "views/frame/dbus_appmenu.cc",
        "views/frame/dbus_appmenu.h",
        "views/frame/dbus_appmenu_registrar.cc",
        "views/frame/dbus_appmenu_registrar.h",
      ]
      defines += [ "USE_DBUS_MENU" ]
      deps += [ "//ui/gfx/x" ]
    }
print("MARK")
print(defines)
print("MARK")
<snip>

Output
MARK
["USE_DBUS", "USE_DBUS_MENU"]
MARK

@probonopd
Copy link
Member Author

OK, so https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=259575 is currently not addressing the root of the issue and needs to be changed?

@jsm222
Copy link

jsm222 commented Nov 1, 2021

OK, so https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=259575 is currently not addressing the root of the issue and needs to be changed?

Yes, you should probably close it..

@probonopd
Copy link
Member Author

Closed.

Now we need to isolate why it's not working...

@jsm222
Copy link

jsm222 commented Nov 1, 2021

on FreeBSD..
dbus-monitor | grep -i menu

   string "type='signal',interface='ca.desrt.dconf.Writer',path='/ca/desrt/dconf/Writer/user',arg0path='/org/appmenu/gtk-module/'"
   string "type='signal',interface='ca.desrt.dconf.Writer',path='/ca/desrt/dconf/Writer/user',arg0path='/org/appmenu/gtk-module/'"
   string "type='signal',interface='ca.desrt.dconf.Writer',path='/ca/desrt/dconf/Writer/user',arg0path='/org/appmenu/gtk-module/'"
   string "type='signal',interface='ca.desrt.dconf.Writer',path='/ca/desrt/dconf/Writer/user',arg0path='/org/appmenu/gtk-module/'"
   string "type='signal',interface='org.freedesktop.DBus',member='NameOwnerChanged',path='/org/freedesktop/DBus',sender='org.freedesktop.DBus',arg0='com.canonical.AppMenu.Registrar'"
   string "com.canonical.AppMenu.Registrar"
   string "Could not get owner of name 'com.canonical.AppMenu.Registrar': no such name"
   string "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',path='/org/freedesktop/DBus',arg0='com.canonical.AppMenu.Registrar'"
   string "com.canonical.AppMenu.Registrar"
   string "Could not get owner of name 'com.canonical.AppMenu.Registrar': no such name"
   string "type='signal',interface='ca.desrt.dconf.Writer',path='/ca/desrt/dconf/Writer/user',arg0path='/org/appmenu/gtk-module/'"
   string "type='signal',interface='ca.desrt.dconf.Writer',path='/ca/desrt/dconf/Writer/user',arg0path='/org/appmenu/gtk-module/'"

on neon devel (linux)

method call time=1635797828.548305 sender=:1.56 -> destination=:1.53 serial=12503 path=/MenuBar/1; interface=com.canonical.dbusmenu; member=Event
method call time=1635797828.570915 sender=:1.56 -> destination=:1.53 serial=12504 path=/MenuBar/1; interface=com.canonical.dbusmenu; member=AboutToShow
method call time=1635797828.570996 sender=:1.56 -> destination=:1.53 serial=12505 path=/MenuBar/1; interface=com.canonical.dbusmenu; member=Event
method call time=1635797828.637894 sender=:1.56 -> destination=:1.53 serial=12506 path=/MenuBar/1; interface=com.canonical.dbusmenu; member=AboutToShow
method call time=1635797828.637988 sender=:1.56 -> destination=:1.53 serial=12507 path=/MenuBar/1; interface=com.canonical.dbusmenu; member=Event
method call time=1635797828.660185 sender=:1.56 -> destination=:1.53 serial=12508 path=/MenuBar/1; interface=com.canonical.dbusmenu; member=AboutToShow
method call time=1635797828.660271 sender=:1.56 -> destination=:1.53 serial=12509 path=/MenuBar/1; interface=com.canonical.dbusmenu; member=Event
method call time=1635797828.681647 sender=:1.56 -> destination=:1.53 serial=12510 path=/MenuBar/1; interface=com.canonical.dbusmenu; member=AboutToShow
method call time=1635797828.681728 sender=:1.56 -> destination=:1.53 serial=12511 path=/MenuBar/1; interface=com.canonical.dbusmenu; member=Event

@jsm222
Copy link

jsm222 commented Nov 1, 2021

dbus-send --session --print-reply --dest=org.freedesktop.DBus / org.freedesktop.DBus.GetConnectionUnixProcessID string:com.canonical.AppMenu.Registrar
gives the pid of /usr/bin/kded5 on neon, so that is what helps the menu magic apparently.. It is probably a lot of code..

@probonopd
Copy link
Member Author

probonopd commented Nov 1, 2021

On helloSystem:

FreeBSD% dbus-send --session --print-reply --dest=org.freedesktop.DBus / org.freedesktop.DBus.GetConnectionUnixProcessID string:com.canonical.AppMenu.Registrar
method return time=1635799924.625188 sender=org.freedesktop.DBus -> destination=:1.152 serial=3 reply_serial=2
   uint32 1871

FreeBSD% ps ax | grep 1871
1871  -  S      0:51,66 /System/Menu.AppDir/AppRun (Menu)

I think the question is: What is causing the string "Could not get owner of name 'com.canonical.AppMenu.Registrar': no such name" ...

@probonopd
Copy link
Member Author

@jsm222 mentioned in the chat:

I've got gobal menu for chrome on freebsd plasma
export DBUS_SESSION_BUS_ADDRESS="unix:path=/tmp/dbus-FQqYijVekv"
where you get the path from sockstat
so chromium is capable also on FreeBSD to do the dbus menu thing

We have:

FreeBSD% env | grep DBUS
DBUS_SESSION_BUS_ADDRESS=unix:path=/tmp/dbus-qEy5CoDYoN,guid=54ade93d38f2020fd66560ca61823d80
DBUS_SESSION_BUS_PID=1670
DBUS_SESSION_BUS_WINDOWID=8388609

FreeBSD% sockstat | grep Menu                                         
user     Menu       1769  4  stream -> /tmp/.X11-unix/X0
user     Menu       1769  10 stream /tmp/qtsingleapp-Menu-ff2e-3e9
user     Menu       1769  30 stream -> /tmp/dbus-qEy5CoDYoN

Why isn't it working then?

Doing manually

export DBUS_SESSION_BUS_ADDRESS='unix:path=/tmp/dbus-qEy5CoDYoN'
chrome

does not lead to a change.

How exactly does Chrome determine whether a Global Menu is available on the system? We should be able to find this out by looking at the Chrome source code.

@jsm222
Copy link

jsm222 commented Nov 3, 2021

I have looked into, under kde the fallback menu dbus adresses are set as window properties. the _KDE ones used by app-gtk-menu. It seems that chrome windows do not accept the change by app-gtk-menu lib done in XChangeProperty. Im still digging..

@probonopd
Copy link
Member Author

Do you mean these?

static const QByteArray s_x11AppMenuServiceNamePropertyName = QByteArrayLiteral("_KDE_NET_WM_APPMENU_SERVICE_NAME");
static const QByteArray s_x11AppMenuObjectPathPropertyName = QByteArrayLiteral("_KDE_NET_WM_APPMENU_OBJECT_PATH");

Menu should be aware of them (although I have never fully understood why they are needed as a KDE-specific thing).

@jsm222
Copy link

jsm222 commented Nov 3, 2021

I have looked into, under kde the fallback menu dbus adresses are set as window properties. the _KDE ones used by app-gtk-menu. It seems that chrome windows do not accept the change by app-gtk-menu lib done in XChangeProperty. Im still digging..

eral("_KDE_NET_WM_APPMENU_OBJECT_PATH");

Yes, they are only set under plasma5

@probonopd
Copy link
Member Author

probonopd commented Nov 3, 2021

The plasma5-plasma-workspace package comes with:

FreeBSD% tar xfv ../plasma5-plasma-workspace-5.22.5.pkg
FreeBSD% find usr/local/share/dbus-1                                               
usr/local/share/dbus-1
usr/local/share/dbus-1/system-services
usr/local/share/dbus-1/system-services/org.kde.fontinst.service
usr/local/share/dbus-1/system.d
usr/local/share/dbus-1/system.d/org.kde.fontinst.conf
usr/local/share/dbus-1/services
usr/local/share/dbus-1/services/org.kde.KSplash.service
usr/local/share/dbus-1/services/org.kde.runners.baloo.service
usr/local/share/dbus-1/services/org.kde.plasma.Notifications.service
usr/local/share/dbus-1/services/org.kde.krunner.service
usr/local/share/dbus-1/services/org.kde.LogoutPrompt.service
usr/local/share/dbus-1/services/org.kde.fontinst.service
usr/local/share/dbus-1/services/org.kde.Shutdown.service
usr/local/share/dbus-1/interfaces
usr/local/share/dbus-1/interfaces/org.kde.kappmenu.xml
usr/local/share/dbus-1/interfaces/org.kde.KSplash.xml
usr/local/share/dbus-1/interfaces/org.kde.PlasmaShell.xml
usr/local/share/dbus-1/interfaces/org.kde.KSMServerInterface.xml
usr/local/share/dbus-1/interfaces/org.kde.krunner.App.xml
usr/local/share/dbus-1/interfaces/com.canonical.AppMenu.Registrar.xml

I never quite understood what those files are needed for - can't this kind of information be published over D-Bus itself ("introspection")? The concept of having to copy around xml files in the filesystem (in places only root can access) even though the files describe the per-user ("session") bus strikes me as strange.

And I am completely at a loss at how to handle the situation that more than one application (e.g., helloSystem Menu) would need(?) to provide the same file, /usr/local/share/dbus-1/interfaces/com.canonical.AppMenu.Registrar.xml.

In any case, just copying KDE's /usr/local/share/dbus-1/interfaces/com.canonical.AppMenu.Registrar.xml into the system doesn't suddenly make Chromium fill the global menu.

@probonopd
Copy link
Member Author

xprop | APPMENU and then clicking on a window gives _KDE_NET_WM_APPMENU_OBJECT_PATH and _KDE_NET_WM_APPMENU_SERVICE_NAME for most windows but not for Chromium windows on helloSystem.

@jsm222 thinks that in KDE Plasma, something else sets those, and on helloSystem they get set for the wrong window(id).

@probonopd
Copy link
Member Author

Let's see what deals with (the largely undocumented) _KDE_NET_WM_APPMENU_OBJECT_PATH...

FreeBSD% sudo grep -r _KDE_NET_WM_APPMENU_OBJECT_PATH /usr 2>/dev/null

# On helloSystem:
Binary file /usr/local/bin/gmenudbusmenuproxy matches
Binary file /usr/local/lib/libKF5WindowSystem.so.5 matches
Binary file /usr/local/lib/libKF5WindowSystem.so matches
Binary file /usr/local/lib/libkwin.so.5 matches
Binary file /usr/local/lib/libKF5WindowSystem.so.5.86.0 matches
Binary file /usr/local/lib/libkwin.so.5.22.5 matches
Binary file /usr/local/lib/qt5/plugins/platformthemes/libpanda-qtplugin.so matches

# On KDE Plasma:
Binary file /usr/local/lib/qt5/plugins/kf5/kded/appmenu.so matches
Binary file /usr/local/bin/gmenudbusmenuproxy matches

# On Airyx:
Binary file /System/Library/Frameworks/AppKit.framework/Versions/Current/libAppKit.so matches
Binary file /System/Library/Frameworks/AppKit.framework/Versions/A/libAppKit.so matches
Binary file /System/Library/Frameworks/AppKit.framework/libAppKit.so matches

So, is /usr/local/lib/qt5/plugins/kf5/kded/appmenu.so doing additional trickery that helps Chromium?

@jsm222
Copy link

jsm222 commented Nov 7, 2021

Try this patch https://gist.github.com/jsm222/8b6a92566e7ce53bdc5ec094c1093549.
Works for me on FreeBSD...

@probonopd
Copy link
Member Author

Bravo! @jsm222 this is an awesome contribution. Thank you very, very much. I would never have figured this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants