From bf5ffcc2af5bbd8b4277a4b2cf99f51b070bcf45 Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Tue, 21 Apr 2026 17:58:24 -0400 Subject: [PATCH] fix: apply blur enabled to system theme --- src/app/cosmic.rs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/app/cosmic.rs b/src/app/cosmic.rs index 56711dbf..6fd97110 100644 --- a/src/app/cosmic.rs +++ b/src/app/cosmic.rs @@ -857,6 +857,7 @@ impl Cosmic { crate::core::AppType::Applet => t.frosted_applets, } }; + theme.transparent = new_blur; let mut guard = THEME.lock().unwrap(); guard.set_theme(theme.theme_type.clone()); @@ -866,8 +867,6 @@ impl Cosmic { let core = self.app.core(); #[cfg(all(feature = "wayland", target_os = "linux"))] { - use crate::widget::wrapper; - let mut cmds = Vec::with_capacity(1 + self.surface_views.len()); let blur = if new_blur { iced::window::enable_blur @@ -1361,7 +1360,6 @@ impl Cosmic { SurfaceIdWrapper::Popup(_) | SurfaceIdWrapper::LayerSurface(_) ) }); - let core = self.app.core(); let new_blur = self.blur_enabled && { let t = theme.cosmic(); match self.app.core().app_type() { @@ -1370,14 +1368,14 @@ impl Cosmic { crate::core::AppType::Applet => t.frosted_applets, } }; - theme.transparent = new_blur; + let wrapper = self .surface_views .get(&id) .map(|s| s.1) .or(self.tracked_surfaces.get(&id).copied()); // this will blur untracked windows as if they were the main window - let blur_cmd = if core.blur(&theme, wrapper) { + let blur_cmd = if self.app.core().blur(&theme, wrapper) { let blur = if new_blur { iced::window::enable_blur } else { @@ -1421,20 +1419,21 @@ impl Cosmic { #[cfg(all(feature = "wayland", target_os = "linux"))] Action::BlurEnabled => { // TODO do this after blur event confirms support instead of for all wayland windows - let core = self.app.core(); self.blur_enabled = true; + let mut t = THEME.lock().unwrap(); + let new_blur = self.blur_enabled && { - let t = core.system_theme.cosmic(); + let t = t.cosmic(); match self.app.core().app_type() { crate::core::AppType::Window => t.frosted_windows, crate::core::AppType::System => t.frosted_system_interface, crate::core::AppType::Applet => t.frosted_applets, } }; - let mut t = THEME.lock().unwrap(); - t.transparent = matches!(&t.theme_type, ThemeType::System { .. }) && new_blur; + t.transparent = new_blur; + self.app.core_mut().system_theme.transparent = new_blur; { let blur = if new_blur { iced::window::enable_blur @@ -1442,7 +1441,7 @@ impl Cosmic { iced::window::disable_blur }; let mut cmds = Vec::with_capacity(1 + self.surface_views.len()); - if core.blur(&t, None) { + if self.app.core().blur(&t, None) { cmds.push(blur( self.app .core() @@ -1451,12 +1450,12 @@ impl Cosmic { )); } for (id, wrapper, ..) in &self.surface_views { - if core.blur(&t, Some(wrapper.1)) { + if self.app.core().blur(&t, Some(wrapper.1)) { cmds.push(blur(*id)); } } for (id, wrapper) in &self.tracked_surfaces { - if core.blur(&t, Some(*wrapper)) { + if self.app.core().blur(&t, Some(*wrapper)) { cmds.push(blur(*id)); } }