Skip to content

Linux/GNOME Wayland: support interactive XWayland overlays (meeting capsules / Annotate) #85

Done

Description

@lgwacker

Summary

On GNOME Wayland (Mutter has no zwlr_layer_shell_v1), Rune falls back to XWayland for overlays — but only when they take no input. Interactive overlays (interactive: true / any non-OverlayInput::None, or KeyPolicy::OnDemand) return None from the XWayland path and fail with:

rune: overlay … can't show: the platform could not create its window or surface

That breaks Hex meeting offer/recording capsules and Annotate overlays on Ubuntu GNOME, even though XWayland is present and the non-interactive dictation HUD works.

Context from Hex: anomalyco/hex#1271 (closed with a Meetings-pane fallback in hex#1273). The pane fallback avoids a silent timeout; it does not restore floating interactive capsules. The durable fix belongs here.

Environment (repro host)

  • Ubuntu 24.04.5 LTS, GNOME Shell 46 / Mutter, Wayland
  • XWayland available (DISPLAY=:1)
  • Hex 0.0.0-dev-721 (consumes Rune overlays)

Current behavior

From crates/rune/src/overlay/xwayland.rs:

if self.options.input.resolved(self.interactive) != OverlayInput::None
    || self.options.keys == KeyPolicy::OnDemand
{
    return None;
}

XwaylandSurface always installs an empty input SHAPE and asks for no events (platform/x11/xwayland.rs). Pure X11 overlays already support interactive input via platform/x11/overlay.rs (OverlayInput::All / region SHAPE).

So on GNOME:

  1. layer() fails (no layer-shell)
  2. xwayland() returns None for interactive overlays
  3. prepare() fails with “could not create its window or surface”

Expected behavior

Interactive overlays on GNOME Wayland should show through XWayland (same override-redirect ARGB notification window), with pointer hit-testing for buttons/regions, without forcing the host app to open a normal focus-taking window.

Suggested fix

Extend the XWayland overlay path to match what pure X11 already does:

  1. Allow OverlayInput::All and regional input on XwaylandSurface (do not hard-reject interactive).
  2. Apply SHAPE input regions instead of always emptying them; reuse the patterns in platform/x11/overlay.rs.
  3. Deliver pointer events on that X11 connection into the overlay runtime (today the XWayland surface drains/ignores events).
  4. Keep click-through outside interactive regions; avoid taking keyboard focus unless KeyPolicy asks for it.
  5. Leave the existing input-none path unchanged for HUD-style overlays.

Hex can keep the #1273 Meetings-pane path as a last-resort fallback when the overlay is still Unavailable.

Why not only the Hex workaround

Opening the Meetings window mid-call recovers “can record,” but:

  • steals focus during a Meet/Zoom call
  • still leaves the floating recording indicator unavailable
  • leaves Annotate interactive overlays broken for the same Rune limitation

Related

Activity

  1. lgwacker commented on Nov 4, 2026

    @lgwacker
    Author

    Hex follow-up tracking the product side of this: anomalyco/hex#1274 (keeps the #1273 Meetings-pane fallback as last resort once interactive XWayland overlays land here).

  2. godismyjudge95 commented on Nov 6, 2026

    @godismyjudge95

    A second use case, and an update on what dev already does.

    Status on dev d03349e2

    The pointer part of this issue works now, behind an opt-in. With OverlayOptions::xwayland_input = true, an interactive overlay shows on XWayland and takes clicks in its input shape (overlay/options.rs#L128-L134, platform/x11/xwayland.rs#L1-L7). We use it on GNOME 50 and pointer input works.

    Two gaps are left.

    1. Keys. overlay/xwayland.rs#L28-L33 refuses XWayland for KeyPolicy::OnDemand, and then the overlay has no surface at all. An override-redirect window never gets keyboard focus.
    2. Display choice. platform/x11/xwayland.rs#L175 passes None as the requested display to choose_display. So DisplayTarget::Id and DisplayTarget::Native are ignored, and the overlay goes on the display under the pointer or the primary one. An app cannot put one overlay on each monitor.

    Our use case

    A screenshot region selector. It is a full-screen overlay on every monitor that shows a frozen frame of that monitor. The user drags a box, holds Space to move it, uses the arrow keys to nudge it, Enter to capture and Escape to cancel. GNOME has no layer-shell, so we use the XWayland path.

    What we do today, on Ubuntu 26.04, GNOME 50 Wayland:

    • One overlay with DisplayTarget::Primary, OverlayPlacement::FullScreen, OverlayInput::All, xwayland_input: true and KeyPolicy::None. Asking for keys would leave no surface.
    • Keys reach us only through the main window's on_key, so they work only while our main window has keyboard focus. A capture started from the tray or a global shortcut while another app has focus would have no Escape (from the code path; we did not test it).
    • Our test VM has one monitor, so we did not see the second gap on screen. It is from reading the code above.

    Asks

    • A way for an interactive overlay on GNOME Wayland to get keys while it shows, delivered to its on_key. We have not tested a mechanism. Two candidates: an XGrabKeyboard on the XWayland window (Mutter may refuse X grabs unless its xwayland-grab-access-rules allow the app), or, for a modal full-screen overlay, a fullscreen xdg_toplevel on that output instead of XWayland. A capsule-style overlay could keep KeyPolicy::None.
    • Pass the requested display through on XWayland: map DisplayTarget::Id/Native to the RandR monitor with the same geometry and pass its index as requested to choose_display.

    Done when: on GNOME Wayland with two monitors, an app can show one interactive full-screen overlay per monitor with DisplayTarget::Native, and Escape pressed while one of them shows reaches its on_key with no app window focused.


    Posted via Claude

  3. godismyjudge95 commented on Nov 6, 2026

    @godismyjudge95

    Related, filed since our comment: #146 (the display list is fixed at startup, so there is no way to put an overlay on a monitor added later) and #142 (a hidden Wayland/XWayland overlay keeps its last images in memory).


    Posted via Claude

  4. opencodejr commented on Nov 25, 2026

    @opencodejr
    Contributor

    Thanks for the detailed write-up. The pointer side of this is already on dev (commit 50390a3e, which references this issue), behind an opt-in:

    OverlayOptions { xwayland_input: true, /* input: OverlayInput::All or Regions, keys: KeyPolicy::None */ .. }
    // or, before a show:
    handle.set_xwayland_input(true);

    When a Wayland compositor has no layer-shell (GNOME/Mutter), an overlay that takes the pointer and has this flag set shows on XWayland. It uses the same override-redirect ARGB window as the HUD. Its input shape covers either the whole window or its hit regions, so clicks outside those regions pass through to the windows below. It reads its own pointer events: move, enter, leave, and primary and secondary buttons. Being override-redirect, it never takes keyboard focus. The flag is off by default because connecting to the X server starts XWayland on GNOME, so the host has to opt in, ideally after checking that XWayland is already running. See OverlayOptions::xwayland_input in crates/rune/src/overlay/options.rs and changelog/unreleased/2026-11-04-xwayland-interactive-overlay.md.

    Two later fixes also matter for capsules:

    For Hex, setting xwayland_input: true on the meeting capsules and Annotate overlays (with KeyPolicy::None) should bring back the floating, non-focus-taking path. Keep the #1273 pane fallback for when the overlay is still Unavailable.

    Two limits remain, both noted in the comment above:

    • KeyPolicy::OnDemand overlays still can't use XWayland.
    • The XWayland path ignores DisplayTarget::Id/Native and puts the overlay on the display under the pointer or the primary one.

    If either of these blocks you, please open a separate issue for it so it can be tracked on its own.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions