feat: add gtk and kde appmenu protocols

This commit is contained in:
81reap 2026-04-06 23:47:12 -04:00
parent e83a9dff82
commit f620b2f4ba
3 changed files with 142 additions and 0 deletions

89
protocols/gtk-shell.xml Normal file
View file

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="gtk">
<copyright><![CDATA[
SPDX-FileCopyrightText: GTK contributors
SPDX-License-Identifier: LGPL-2.1-or-later
]]></copyright>
<!--
Trimmed subset of GTK's gtk-shell.xml, vendored from:
https://gitlab.gnome.org/GNOME/gtk
gdk/wayland/protocol/gtk-shell.xml
Upstream declares both interfaces at version 7. This copy is
pruned to version 1, retaining only the requests and events that
mango handles. The motivating use is set_dbus_properties, which
publishes the per-surface DBus app-menu metadata that mango
re-broadcasts to external panels (mangowm/mango#832).
Removed relative to upstream (none of these affect menu publication):
gtk_shell1: notify_launch (since 3)
gtk_surface1: configure_edges, edge_constraint enum (since 2),
request_focus (since 3), release (since 4),
titlebar_gesture, gesture/error enums (since 5),
set_a11y_properties (since 7),
tiled_top/right/bottom/left state values (since 2)
Kept-but-unimplemented vtable slots (no-ops in the compositor):
gtk_shell1.set_startup_id, gtk_shell1.system_bell,
gtk_surface1.set_modal, gtk_surface1.unset_modal,
gtk_surface1.present
-->
<interface name="gtk_shell1" version="1">
<description summary="gtk specific extensions">
gtk_shell is a protocol extension providing additional features for
clients implementing it.
</description>
<enum name="capability">
<entry name="global_app_menu" value="1"/>
<entry name="global_menu_bar" value="2"/>
<entry name="desktop_icons" value="3"/>
</enum>
<event name="capabilities">
<arg name="capabilities" type="uint"/>
</event>
<request name="get_gtk_surface">
<arg name="gtk_surface" type="new_id" interface="gtk_surface1"/>
<arg name="surface" type="object" interface="wl_surface"/>
</request>
<request name="set_startup_id">
<arg name="startup_id" type="string" allow-null="true"/>
</request>
<request name="system_bell">
<arg name="surface" type="object" interface="gtk_surface1" allow-null="true"/>
</request>
</interface>
<interface name="gtk_surface1" version="1">
<request name="set_dbus_properties">
<arg name="application_id" type="string" allow-null="true"/>
<arg name="app_menu_path" type="string" allow-null="true"/>
<arg name="menubar_path" type="string" allow-null="true"/>
<arg name="window_object_path" type="string" allow-null="true"/>
<arg name="application_object_path" type="string" allow-null="true"/>
<arg name="unique_bus_name" type="string" allow-null="true"/>
</request>
<request name="set_modal"/>
<request name="unset_modal"/>
<request name="present">
<arg name="time" type="uint"/>
</request>
<enum name="state">
<entry name="tiled" value="1"/>
</enum>
<event name="configure">
<arg name="states" type="array"/>
</event>
</interface>
</protocol>

51
protocols/kde-appmenu.xml Normal file
View file

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="appmenu">
<copyright><![CDATA[
SPDX-FileCopyrightText: 2017 David Edmundson <davidedmundson@kde.org>
SPDX-License-Identifier: MIT
]]></copyright>
<!--
Vendored verbatim from plasma-wayland-protocols:
https://invent.kde.org/libraries/plasma-wayland-protocols
src/protocols/appmenu.xml
Used by mango to support global application menus on Wayland
(mangowm/mango#832). The compositor stores the per-surface DBus
address published by clients and re-broadcasts it to external
panels via the dwl-ipc-unstable-v2 protocol.
-->
<interface name="org_kde_kwin_appmenu_manager" version="2">
<description summary="appmenu dbus address interface">
This interface allows a client to link a window (or wl_surface) to an com.canonical.dbusmenu
interface registered on DBus.
</description>
<request name="create">
<arg name="id" type="new_id" interface="org_kde_kwin_appmenu"/>
<arg name="surface" type="object" interface="wl_surface"/>
</request>
<!-- version 2 additions-->
<request name="release" type="destructor" since="2">
<description summary="destroy the org_kde_kwin_appmenu_manager object" />
</request>
</interface>
<interface name="org_kde_kwin_appmenu" version="2">
<description summary="appmenu dbus address interface">
The DBus service name and object path where the appmenu interface is present
The object should be registered on the session bus before sending this request.
If not applicable, clients should remove this object.
</description>
<request name="set_address">
<description summary="initialise or update the location of the AppMenu interface">
Set or update the service name and object path.
Strings should be formatted in Latin-1 matching the relevant DBus specifications.
</description>
<arg name="service_name" type="string" />
<arg name="object_path" type="string" />
</request>
<request name="release" type="destructor">
<description summary="release the appmenu object"/>
</request>
</interface>
</protocol>

View file

@ -24,6 +24,8 @@ wayland_xmls = [
'dwl-ipc-unstable-v2.xml',
'wlr-layer-shell-unstable-v1.xml',
'wlr-output-power-management-unstable-v1.xml',
'kde-appmenu.xml',
'gtk-shell.xml',
]
wayland_sources = [
wayland_scanner_code.process(wayland_xmls),