#3035

(TitleBar) There are no window decorations on Wayland

Openmartenioopened 1mo ago

No window decorations are rendered on GNOME (Wayland), there is no close, minimize etc buttons. It also doesn't render using a TitleBar.

Code:

use gpui_kit::component::*;
use gpui_kit::*;

pub struct HelloWorld;

impl Render for HelloWorld {
    fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
        TitleBar::new()
            .child(div().child("My Application"))
    }
}

fn main() {
    gpui_kit::application().run(move |cx| {
        gpui_kit::init(cx);

        cx.spawn(async move |cx| {
            cx.open_window(WindowOptions::default(), |window, cx| {
                let view = cx.new(|_| HelloWorld);
                cx.new(|cx| Root::new(view, window, cx))
            })
            .expect("Failed to open window");
        })
        .detach();
    });
}

References https://github.com/wolfpld/tracy/issues/505#issuecomment-1365429443

Activity

3
martenio1mo ago

I have also tried

// Explicitly define titlebar options
            let options = WindowOptions {
                titlebar: Some(TitlebarOptions {
                    title: Some("My GPUI App".into()),
                    appears_transparent: false,
                    traffic_light_position: None,
                }),
                ..Default::default()
            };

Edit: And with window_decorations: Some(WindowDecorations::Server),

martenio1mo ago

Workaround

You can force GPUI down the X11 path from inside a Wayland session simply by unsetting/clearing WAYLAND_DISPLAY before launching:

WAYLAND_DISPLAY= cargo run