Skip to content

Commit 88fc193

Browse files
committed
Add app id setting for linux
1 parent f21958c commit 88fc193

2 files changed

Lines changed: 38 additions & 1 deletion

File tree

winit/src/settings.rs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,18 @@ mod platform;
77
#[path = "settings/macos.rs"]
88
mod platform;
99

10+
#[cfg(target_os = "linux")]
11+
#[path = "settings/linux.rs"]
12+
mod platform;
13+
1014
#[cfg(target_arch = "wasm32")]
1115
#[path = "settings/wasm.rs"]
1216
mod platform;
1317

1418
#[cfg(not(any(
1519
target_os = "windows",
1620
target_os = "macos",
21+
target_os = "linux",
1722
target_arch = "wasm32"
1823
)))]
1924
#[path = "settings/other.rs"]
@@ -150,7 +155,6 @@ impl Window {
150155
}
151156

152157
#[cfg(any(
153-
target_os = "linux",
154158
target_os = "dragonfly",
155159
target_os = "freebsd",
156160
target_os = "netbsd",
@@ -192,6 +196,28 @@ impl Window {
192196
);
193197
}
194198

199+
#[cfg(target_os = "linux")]
200+
{
201+
#[cfg(feature = "x11")]
202+
{
203+
use winit::platform::x11::WindowBuilderExtX11;
204+
205+
window_builder = window_builder.with_name(
206+
&self.platform_specific.application_id,
207+
&self.platform_specific.application_id,
208+
);
209+
}
210+
#[cfg(feature = "wayland")]
211+
{
212+
use winit::platform::wayland::WindowBuilderExtWayland;
213+
214+
window_builder = window_builder.with_name(
215+
&self.platform_specific.application_id,
216+
&self.platform_specific.application_id,
217+
);
218+
}
219+
}
220+
195221
window_builder
196222
}
197223
}

winit/src/settings/linux.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//! Platform specific settings for Linux.
2+
3+
/// The platform specific window settings of an application.
4+
#[derive(Debug, Clone, PartialEq, Eq, Default)]
5+
pub struct PlatformSpecific {
6+
/// Sets the application id of the window.
7+
///
8+
/// As a best practice, it is suggested to select an application id that match
9+
/// the basename of the application’s .desktop file.
10+
pub application_id: String,
11+
}

0 commit comments

Comments
 (0)