dkondor/gtk_global_menu_test
Test app for global menus on Wayland
GTK Global menu test
Test application for global menus on Wayland.
Warning the software in this repository is meant for demonstration purposes only and relies on functionality not present in any available Wayland compositor. Please do not submit bug reports to other projects if you experience issues. See the related PRs:
https://gitlab.freedesktop.org/wlroots/wlr-protocols/-/merge_requests/131
https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4986
WayfireWM/wayfire#2576
This app demonstrates potential functionality proposed for the wlr-foreign-toplevel-management protocol (included in this repository) that would allow a compositor to relay information about global menus to a desktop component (e.g. a panel or dock). It is meant as a minimal example and will simple present menus of compatible apps in its main window. Both the org.gtk.Menus and the com.canonical.dbusmenu interfaces are supported.
Requirements
- Compositor implementation of the proposed protocol extension; use this or this branch for wlroots and this branch of Wayfire.
- Libraries and development files for GLib, Gtk 3.0 and GDK
- Libraries and development files for Wayland (
wayland-client) and thewayland-scannerprogram - Libraries and development files for dbusmenu-gtk3 (on Ubuntu, this means the
libdbusmenu-gtk3-devpackage) appmenu-gtk3-module
Compiling
Use the standard Meson way:
meson setup build
ninja -C build
Running
Start from the build folder (it will not be installed):
build/gtk_global_menu_test
The app-id of the last active app is displayed, and if it supports global menus, its menu can be shown by clicking on the "Show menu" button. Note: in some case, the active app is not correctly detected and you might need to switch away and back to it for things to work.
Making apps work
So far, I've tested it with GTK3 and Qt5 apps, specifically with Gedit, Inkscape and Kate (versions available in Ubuntu 24.04). The following are required to make apps actually export their menus:
-
A menu "registrar" needs to be running -- this is a program that implements the
com.canonical.AppMenu.RegistrarDBus interface. This actually plays no role on Wayland, but seems to be required to be present to "trigger" exporting menus. A possible implementation is available here (note: it is sufficient to download and run this one file, no need to clone the whole repository). -
For GTK3 apps, you need to set the
GTK_MODULESenvironment variable to includeappmenu-gtk-module -
For Qt apps, you need to set the
XDG_CURRENT_DESKTOPenvironment variable to start withKDE
License
The protocol file (wlr-foreign-toplevel-management-unstable-v1.xml) can be used under the license terms included in it. All other content in this repository is released into the public domain.