mirror of
https://github.com/danbulant/appit
synced 2026-05-19 04:08:34 +00:00
Add app_name to WindowAttributes
This commit is contained in:
parent
043bfe2c78
commit
bcbbb7810e
2 changed files with 25 additions and 0 deletions
17
src/lib.rs
17
src/lib.rs
|
|
@ -272,6 +272,23 @@ impl<Message> Windows<Message> {
|
|||
.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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,6 +137,13 @@ pub struct WindowAttributes<ParentWindowEvent> {
|
|||
pub parent_window: Option<Window<ParentWindowEvent>>,
|
||||
/// 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<String>,
|
||||
}
|
||||
|
||||
impl<User> Default for WindowAttributes<User> {
|
||||
|
|
@ -162,6 +169,7 @@ impl<User> Default for WindowAttributes<User> {
|
|||
window_level: defaults.window_level,
|
||||
active: defaults.active,
|
||||
parent_window: None,
|
||||
app_name: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue