Skip to content

Commit

Permalink
Add app id setting for linux
Browse files Browse the repository at this point in the history
  • Loading branch information
tarkah committed Jul 21, 2023
1 parent f21958c commit 88fc193
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
28 changes: 27 additions & 1 deletion winit/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@ 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;

#[cfg(not(any(
target_os = "windows",
target_os = "macos",
target_os = "linux",
target_arch = "wasm32"
)))]
#[path = "settings/other.rs"]
Expand Down Expand Up @@ -150,7 +155,6 @@ impl Window {
}

#[cfg(any(
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
Expand Down Expand Up @@ -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
}
}
Expand Down
11 changes: 11 additions & 0 deletions winit/src/settings/linux.rs
Original file line number Diff line number Diff line change
@@ -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 application’s .desktop file.
pub application_id: String,
}

0 comments on commit 88fc193

Please sign in to comment.