diff options
| author | srdusr <[email protected]> | 2024-10-31 00:18:00 +0200 |
|---|---|---|
| committer | srdusr <[email protected]> | 2024-10-31 00:18:00 +0200 |
| commit | 4cfe2da2de5886f503ce8bf78bf15cb4f31cfb3c (patch) | |
| tree | 30281a9b7f24e1c996450289738a2a71b2aefbec /crates/x11/src/platform/mod.rs | |
| parent | 9748bca006cd2498c4c0f2730d8789c667bda52b (diff) | |
| download | srdwm-4cfe2da2de5886f503ce8bf78bf15cb4f31cfb3c.tar.gz srdwm-4cfe2da2de5886f503ce8bf78bf15cb4f31cfb3c.zip | |
Add global-menu support (dbusmenu/appmenu) for Wayland and X11 clients
Exposes each window's application menu (Firefox/GTK's dbusmenu export,
X11's _GTK_APPLICATION_OBJECT_PATH-style menus via global_menu.rs) so
an external panel can render it as a system menu bar rather than each
window drawing its own, the same convention appmenu.rs/gtk_shell.rs
and appmenu_registrar.rs wire up across both backends.
Diffstat (limited to 'crates/x11/src/platform/mod.rs')
| -rw-r--r-- | crates/x11/src/platform/mod.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/crates/x11/src/platform/mod.rs b/crates/x11/src/platform/mod.rs index eea936f..04c918c 100644 --- a/crates/x11/src/platform/mod.rs +++ b/crates/x11/src/platform/mod.rs @@ -55,6 +55,26 @@ x11rb::atom_manager! { _NET_CLIENT_LIST, _NET_ACTIVE_WINDOW, UTF8_STRING, + // Global-menu properties - see `read_global_menu`'s doc comment. + // A native X11 client is exactly the same GTK/Qt app the Wayland + // backend's `xwayland.rs::read_global_menu` already reads these + // from (XWayland is just another X server as far as a toolkit is + // concerned), so this is the identical atom set for the identical + // reason. + _GTK_UNIQUE_BUS_NAME, + _GTK_APPLICATION_OBJECT_PATH, + _GTK_WINDOW_OBJECT_PATH, + _GTK_MENUBAR_OBJECT_PATH, + _GTK_APP_MENU_OBJECT_PATH, + _UNITY_OBJECT_PATH, + // KWin's own global-menu property pair - what `libdbusmenu-qt`'s + // KDE integration sets. Already a complete, unambiguous + // `com.canonical.dbusmenu` address on its own (no classification + // needed the way the GTK/Unity atoms above need), and checked + // first in `read_global_menu` for exactly that reason - see that + // method's doc comment. + _KDE_NET_WM_APPMENU_SERVICE_NAME, + _KDE_NET_WM_APPMENU_OBJECT_PATH, } } @@ -121,6 +141,15 @@ pub struct X11Platform { /// itself still starts either way, matching how the Wayland backends /// already treat this as non-fatal. ipc: Option<srdwm_platform::IpcServer>, + /// `com.canonical.AppMenu.Registrar` - the classic Qt/`appmenu-qt5` + /// global-menu source, see `srdwm_platform::appmenu_registrar`'s module + /// doc comment. Unlike the Wayland backend (where this is `None` until + /// XWayland finishes starting up), a native X11 session always has a + /// real X server the moment this struct exists, so it's started + /// unconditionally in `connect` - still `Option` because starting the + /// D-Bus service itself can independently fail (see that module's own + /// `None` handling). + appmenu_registrar: Option<srdwm_platform::AppmenuRegistrarState>, } @@ -139,6 +168,7 @@ impl ClonedForRender for Option<&CoreWindow> { mod actions; mod connect; mod events; +mod global_menu; mod trait_impl; mod window; |