Skip to content

Linux: App::titlebar keeps the system title bar, so GNOME on Wayland gets two bars, or no window controls with decorations off; a fix is on a fork #591

Done

Description

@been-there-done-that

Rev: c92e462 (dev)
Target: Linux, X11 and Wayland. Seen on Ubuntu with GNOME on Wayland, the app running under XWayland.

On macOS and Windows, App::titlebar makes the app's band the window's title bar: the traffic lights or the caption buttons sit over it, and .window_drag() regions move the window. On Linux the system's title bar stays, and Cx::chrome_insets reports zero, so the app's toolbar sits under a second bar with the app's name in it.

An app can't fix this itself. With WindowOptions decorations off, GNOME on Wayland draws nothing at all, because it has no server-side decorations. The window then has no minimize, maximize or close, and can't be resized from its edges.

Fix

892236b is one commit on dev c92e462, on branch linux-csd-titlebar of been-there-done-that/rune.

  • No decorations. A Linux window with a titlebar opens with with_decorations(false), and the app's band is its title bar, as on Windows. Cx::chrome_insets reports the buttons' width and the band's height; headless runs draw the same.
  • Caption buttons. Rune draws minimize, maximize/restore and close at the trailing edge as round 24 pt buttons 12 pt apart, in the GNOME and KDE style (window/titlebar/csd.rs):
    • they are plain elements, so they hover and press like any other;
    • they keep the window's size at every Cx::zoom, as the Windows buttons do;
    • their symbols take Cx::caption_color, else the system's light or dark setting;
    • full screen hides them.
  • Resize edges. A restored, resizable window gets a 6 pt band along each side and 12 pt squares at the corners (window/csd.rs). The pointer there shows the resize cursor, and a press hands the resize to the window manager before the view sees it.
  • Moving. .window_drag() regions move the window and maximize or restore it on a double click. A right click opens the compositor's window menu on Wayland; X11 has none.
  • Shared code. The Windows caption buttons' key, label and press action move into helpers that both frames use. macOS and Windows behaviour is unchanged.
  • Docs and changelog. The Titlebar docs, the crate README and examples/custom_titlebar.rs describe the Linux frame; changelog/unreleased/2026-11-10-linux-client-titlebar.md has the entry.

The changelog entry also notes a trap: like on Windows, the buttons' symbols follow the system's light or dark setting. An app with its own light theme on a dark desktop gets white buttons on a white bar unless it sets Cx::caption_color.

Overlap with #93. #93 adds resize edges and minimize/maximize for borderless app windows on Windows and Linux. This change is for windows with App::titlebar, where Rune draws the buttons itself. Both add an edge band in window/events.rs, so whichever lands second should share the other's hit test.

Verified

  • cargo check -p rune --all-targets on x86_64 Linux: no new warnings. scripts/file-size.sh passes.
  • An app built on the commit, running on GNOME (Wayland, under XWayland): the system bar is gone, the three buttons draw at the toolbar's trailing edge, dragging the toolbar moves the window, and a double click maximizes and restores it.
  • csd_tests.rs covers the edge and corner hit test, the buttons' layout and the insets.

Not yet run: the full cargo test -p rune -p rune-kit --features rune-kit/markdown, a native Wayland (non-XWayland) session, KDE, and macOS or Windows builds of the commit.

Activity

  1. been-there-done-that commented on Nov 11, 2026

    @been-there-done-that
    Author

    Test run on 892236b (x86_64 Linux, Ubuntu with GNOME on Wayland, Rust 1.99.1), using the documented command cargo test -p rune -p rune-kit --features rune-kit/markdown:

    • 2,641 passed, 16 failed, 72 ignored.
    • All six new tests in window/titlebar/csd_tests.rs pass.
    • 14 of the 16 failures also fail on unmodified dev c92e462 on the same machine, so they come from this machine's environment, not this change. For example, copy_select_all_and_the_context_menu reads the desktop's real clipboard, and the sRGB, glyph and italic tests depend on the GPU and fonts.
    • The other two, gpu_static_mips_alpha_clip_and_page_order_match_pixels and a_fast_click_only_counts, failed only under the full parallel run. Run alone on 892236b they pass 3/3.

    By hand, in a real window (GNOME on Wayland, app under XWayland): minimize, maximize/restore and close work; the side and corner edges resize with the right cursors; dragging the toolbar moves the window; and a double click maximizes and restores it.

    One thing an app has to do: if the app's theme doesn't follow the system's light/dark setting, it must call Cx::caption_color. Without it, a light theme on a dark desktop draws white buttons on a white bar. The changelog entry says so.

  2. Hona commented on Nov 24, 2026

    @Hona
    Member

    Carrying over details from duplicate #993, which reports the same double-titlebar issue on native Wayland (GNOME 49 on Fedora 45, where winit draws its grey Adwaita bar above App::titlebar) and links an alternative fork implementation. Two design notes from #993 worth keeping: checking zxdg_decoration_manager_v1 so Wayland compositors with server-side decorations (KDE, Hyprland, Sway) and X11 keep their native frames, and reading GNOME's org.gnome.desktop.wm.preferences button-layout through the settings portal to support close-only and left-side button layouts.

  3. Hona commented on Dec 1, 2026

    @Hona
    Member

    Already fixed on dev via #2244 (e16732a5f), removing the duplicate title bar on Wayland compositors without xdg-decoration (GNOME) and adding Rune caption buttons + resize edge bands. Follow-up shadow/corner polish is tracked separately in #2360. Closing as completed.

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