Skip to content

with_always_on_top() not working on GNOME #7419

@lkdm

Description

@lkdm

Describe the bug

ViewPortBuilder's with_always_on_top() method does not work on GNOME 48 Wayland.

To Reproduce

# Cargo.toml
[package]
name = "rust-egui"
version = "0.1.0"
edition = "2024"

[dependencies]
eframe = { git = "https://github.com/emilk/egui", branch = "main" }
/// main.rs
use eframe::egui::{self, ViewportBuilder};

fn main() -> Result<(), eframe::Error> {
    let viewport = ViewportBuilder::default()
        .with_transparent(true)
        .with_decorations(false)
        .with_has_shadow(false)
        .with_always_on_top()
        .with_mouse_passthrough(true)
        .with_inner_size([320.0, 240.0]);

    let options = eframe::NativeOptions {
        viewport,
        ..Default::default()
    };

    eframe::run_native(
        "Multiple viewports",
        options,
        Box::new(|_cc| Ok(Box::<MyApp>::default())),
    )
}

struct MyApp;

impl Default for MyApp {
    fn default() -> Self {
        Self
    }
}

impl eframe::App for MyApp {
    fn clear_color(&self, _visuals: &egui::Visuals) -> [f32; 4] {
        egui::Rgba::TRANSPARENT.to_array()
    }

    fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
        egui::Window::new("hello")
            .order(egui::Order::Foreground)
            .frame(egui::Frame::NONE) // removes background frame for full transparency
            .show(ctx, |ui| {
                ui.label("Timer overlay with transparency and mouse passthrough");
            });
        ctx.request_repaint();
    }
}

Expected behavior
Window should be transparent, allow mouse events to passthrough, and stay on top of other windows.

Screenshots
As you can see, when I click on another window, it hides part of the egui window.
Image

Desktop (please complete the following information):

  • OS: Bluefin (Version: 42.20250803.2 / FROM Fedora Silverblue 42) running GNOME 48 Wayland

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions