diff --git a/src/lib.rs b/src/lib.rs index f4c1a13..036a4c9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -272,6 +272,23 @@ impl Windows { .with_window_icon(attrs.window_icon) .with_theme(attrs.preferred_theme); + #[cfg(any(target_os = "linux", target_os = "windows"))] + if let Some(app_name) = &attrs.app_name { + #[cfg(target_os = "linux")] + { + builder = winit::platform::wayland::WindowBuilderExtWayland::with_name( + builder, app_name, "", + ); + builder = + winit::platform::x11::WindowBuilderExtX11::with_name(builder, app_name, ""); + } + #[cfg(target_os = "windows")] + { + builder = + platform::windows::WindowBuilderExtWindows::with_name(builder, app_name, ""); + } + } + if let Some(inner_size) = attrs.inner_size { builder = builder.with_inner_size(inner_size); } diff --git a/src/window.rs b/src/window.rs index 2652fca..d842711 100644 --- a/src/window.rs +++ b/src/window.rs @@ -137,6 +137,13 @@ pub struct WindowAttributes { pub parent_window: Option>, /// Whether the window is active or not. pub active: bool, + /// Name of the application + /// + /// - `WM_CLASS` on X11 + /// - application ID on wayland + /// - class name on windows + #[doc(alias("app_id", "class", "class_name"))] + pub app_name: Option, } impl Default for WindowAttributes { @@ -162,6 +169,7 @@ impl Default for WindowAttributes { window_level: defaults.window_level, active: defaults.active, parent_window: None, + app_name: None, } } }