Add app id setting for linux

This commit is contained in:
Cory Forsstrom 2023-07-21 13:57:49 -07:00 committed by Héctor Ramón Jiménez
parent 6d5b69d307
commit 94e991a785
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
2 changed files with 38 additions and 1 deletions

View file

@ -7,6 +7,10 @@ mod platform;
#[path = "settings/macos.rs"]
mod platform;
#[cfg(target_os = "linux")]
#[path = "settings/linux.rs"]
mod platform;
#[cfg(target_arch = "wasm32")]
#[path = "settings/wasm.rs"]
mod platform;
@ -14,6 +18,7 @@ mod platform;
#[cfg(not(any(
target_os = "windows",
target_os = "macos",
target_os = "linux",
target_arch = "wasm32"
)))]
#[path = "settings/other.rs"]
@ -150,7 +155,6 @@ impl Window {
}
#[cfg(any(
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
@ -192,6 +196,28 @@ impl Window {
);
}
#[cfg(target_os = "linux")]
{
#[cfg(feature = "x11")]
{
use winit::platform::x11::WindowBuilderExtX11;
window_builder = window_builder.with_name(
&self.platform_specific.application_id,
&self.platform_specific.application_id,
);
}
#[cfg(feature = "wayland")]
{
use winit::platform::wayland::WindowBuilderExtWayland;
window_builder = window_builder.with_name(
&self.platform_specific.application_id,
&self.platform_specific.application_id,
);
}
}
window_builder
}
}

View file

@ -0,0 +1,11 @@
//! Platform specific settings for Linux.
/// The platform specific window settings of an application.
#[derive(Debug, Clone, PartialEq, Eq, Default)]
pub struct PlatformSpecific {
/// Sets the application id of the window.
///
/// As a best practice, it is suggested to select an application id that match
/// the basename of the applications .desktop file.
pub application_id: String,
}