Merge pull request #2728 from rhysd/blur

Add option to make the transparent window blurry
This commit is contained in:
Héctor 2025-11-20 01:20:25 +01:00 committed by GitHub
commit e9317e7556
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View file

@ -62,6 +62,18 @@ pub struct Settings {
/// Whether the window should be transparent.
pub transparent: bool,
/// Whether the window should have blurry background.
///
/// Note that the blurry effect is applied to the transparent window. You need to enable
/// [`Settings::transparent`] and set a proper opacity value to the background color with
/// `Application::style`.
///
/// This option is only supported on macOS and Linux. Please read the [winit document][winit]
/// for more details.
///
/// [winit]: https://docs.rs/winit/latest/winit/window/struct.Window.html#method.set_blur
pub blur: bool,
/// The window [`Level`].
pub level: Level,
@ -95,6 +107,7 @@ impl Default for Settings {
resizable: true,
decorations: true,
transparent: false,
blur: false,
level: Level::default(),
icon: None,
exit_on_close_request: true,

View file

@ -41,6 +41,7 @@ pub fn window_attributes(
})
.with_decorations(settings.decorations)
.with_transparent(settings.transparent)
.with_blur(settings.blur)
.with_window_icon(settings.icon.and_then(icon))
.with_window_level(window_level(settings.level))
.with_visible(settings.visible);