Skip to content

Commit

Permalink
Add option to make the transparent window blurry
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Jan 13, 2025
1 parent f4eebf0 commit 139e2b4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions core/src/window/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions winit/src/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,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);
Expand Down

0 comments on commit 139e2b4

Please sign in to comment.