Skip to content

Linux: open the window manager's window menu from custom titlebars (Wayland show_window_menu, X11 _GTK_SHOW_WINDOW_MENU) - #2196

Merged
opencodejr[bot] merged 1 commit into
devfrom
bot/issue-313
Nov 25, 2026
Merged

opencodejr[bot] merged 1 commit into
devfrom
bot/issue-313

Conversation

@opencodejr

@opencodejr opencodejr Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Part of #313: the window-menu half. Decoration mode, tiled edges and available actions are not in this PR.

What changed

  • New platform/x11/window_menu.rs: when the window manager lists _GTK_SHOW_WINDOW_MENU in _NET_SUPPORTED, Rune sends that message to the root window as GTK does (data.l = pointer device 2, x and y on the root window, with SubstructureRedirect | SubstructureNotify), on the shared X11 connection (platform::x11::query). The position is the click converted to root coordinates, the current pointer, or the window's top-left corner for Alt+Space. winit's X11 show_window_menu does nothing, which is why Rune sends the message itself.
  • window/chrome.rs:
    • On Wayland, window_menu calls winit's show_window_menu (xdg_toplevel.show_window_menu) at the click, or at the window's top-left corner for the keyboard.
    • has_window_menu is now true on Wayland, and on X11 when the window manager lists the message, so Alt+Space that no handler takes opens the menu on Linux as it does on Windows.
    • Gaps: a touch long-press on Wayland opens the menu at the window's top-left corner, because no point reaches that code. On X11, every Alt+Space checks _NET_SUPPORTED again, which costs a few short round trips to the X server.
  • runtime/input/titlebar.rs: the dead_code attribute on WindowMenu now covers Linux too.
  • README section "Window drag regions" and a changelog entry.

Not in this PR

Reading the decoration mode, tiled edges and available window actions. These need a public API with an explicit "unknown" value. On Wayland, winit would also need to expose the compositor's tiled state and available actions.

Testing

Not compiled or run: the environment this was written in had no Rust toolchain. I checked the x11rb calls against how platform/x11/activation.rs uses them, and the winit call against the vendored source. Added unit tests in platform/x11/window_menu_tests.rs for the message contents and the _NET_SUPPORTED check. Before merging, please run on Linux: cargo check -p rune, cargo clippy -p rune --lib, cargo test -p rune --lib window_menu, and try a right-click on a .window_drag() region on GNOME and KDE, under both X11 and Wayland.

Closes #313

…ayland show_window_menu, X11 _GTK_SHOW_WINDOW_MENU)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Window menu on X11, and tiled states on X11 and Wayland

0 participants