fix: gate frosted transparency on auto_blur

This commit is contained in:
Hojjat 2026-07-15 19:40:09 -06:00 • committed by Michael Murphy
parent ef162b8e16
commit 7e777077b8
2 changed files with 27 additions and 55 deletions

View file

@ -896,14 +896,7 @@ impl<T: Application> Cosmic<T> {
} }
} }
let new_blur = self.blur_enabled && { let new_blur = self.blur_enabled && self.app.core().frosted(theme.cosmic());
let t = theme.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,
}
};
theme.transparent = new_blur; theme.transparent = new_blur;
let mut guard = THEME.lock().unwrap(); let mut guard = THEME.lock().unwrap();
@ -947,14 +940,7 @@ impl<T: Application> Cosmic<T> {
return iced::Task::none(); return iced::Task::none();
} }
// update transparent // update transparent
let new_blur = self.blur_enabled && { let new_blur = self.blur_enabled && self.app.core().frosted(theme.cosmic());
let t = theme.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,
}
};
theme.transparent = new_blur; theme.transparent = new_blur;
let cmd = self.app.system_theme_update(&keys, theme.cosmic()); let cmd = self.app.system_theme_update(&keys, theme.cosmic());
@ -1101,14 +1087,7 @@ impl<T: Application> Cosmic<T> {
} else { } else {
new_theme new_theme
}; };
let new_blur = self.blur_enabled && { let new_blur = self.blur_enabled && core.frosted(new_theme.cosmic());
let t = new_theme.cosmic();
match 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,
}
};
new_theme.transparent = new_blur; new_theme.transparent = new_blur;
core.system_theme = new_theme.clone(); core.system_theme = new_theme.clone();
@ -1283,14 +1262,7 @@ impl<T: Application> Cosmic<T> {
crate::theme::system_light() crate::theme::system_light()
}; };
if let ThemeType::System { .. } = new_theme.theme_type { if let ThemeType::System { .. } = new_theme.theme_type {
let new_blur = self.blur_enabled && { let new_blur = self.blur_enabled && core.frosted(new_theme.cosmic());
let t = new_theme.cosmic();
match 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,
}
};
new_theme.transparent = new_blur; new_theme.transparent = new_blur;
} }
core.system_theme = new_theme.clone(); core.system_theme = new_theme.clone();
@ -1441,14 +1413,7 @@ impl<T: Application> Cosmic<T> {
SurfaceIdWrapper::Popup(_) | SurfaceIdWrapper::LayerSurface(_) SurfaceIdWrapper::Popup(_) | SurfaceIdWrapper::LayerSurface(_)
) )
}); });
let new_blur = self.blur_enabled && { let new_blur = self.blur_enabled && self.app.core().frosted(theme.cosmic());
let t = theme.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 wrapper = self.surface_views.get(&id).map(|s| s.1); let wrapper = self.surface_views.get(&id).map(|s| s.1);
@ -1512,14 +1477,7 @@ impl<T: Application> Cosmic<T> {
self.blur_enabled = true; self.blur_enabled = true;
let mut t = THEME.lock().unwrap(); let mut t = THEME.lock().unwrap();
let new_blur = self.blur_enabled && { let new_blur = self.blur_enabled && self.app.core().frosted(t.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,
}
};
t.transparent = new_blur; t.transparent = new_blur;

View file

@ -538,6 +538,20 @@ impl Core {
self.auto_blur self.auto_blur
} }
/// Whether the active theme's frosted (blur) styling should apply to this
/// app's surfaces.
#[must_use]
pub fn frosted(&self, theme: &cosmic_theme::Theme) -> bool {
if self.auto_blur.is_empty() {
return false;
}
match self.app_type {
AppType::Window => theme.frosted_windows,
AppType::System => theme.frosted_system_interface,
AppType::Applet => theme.frosted_applets,
}
}
pub fn set_auto_corner_radius(&mut self, auto_corner_radius: BitFlags<Auto>) { pub fn set_auto_corner_radius(&mut self, auto_corner_radius: BitFlags<Auto>) {
self.auto_corner_radius = auto_corner_radius; self.auto_corner_radius = auto_corner_radius;
} }
@ -570,13 +584,13 @@ impl Core {
Some(SurfaceIdWrapper::Window(_)) => { Some(SurfaceIdWrapper::Window(_)) => {
theme.frosted_windows && self.auto_blur.contains(Auto::Window) theme.frosted_windows && self.auto_blur.contains(Auto::Window)
} }
Some(SurfaceIdWrapper::Popup(_)) Some(SurfaceIdWrapper::Popup(_)) => {
if matches!(self.app_type, AppType::Window | AppType::System) => self.auto_blur.contains(Auto::Popup)
{ && match self.app_type {
theme.frosted_windows && self.auto_blur.contains(Auto::Popup) AppType::Window => theme.frosted_windows,
} AppType::System => theme.frosted_system_interface,
Some(SurfaceIdWrapper::Popup(_)) if matches!(self.app_type, AppType::Applet) => { AppType::Applet => theme.frosted_applets,
theme.frosted_applets && self.auto_blur.contains(Auto::Popup) }
} }
None => match self.app_type { None => match self.app_type {
AppType::Window => theme.frosted_windows && self.auto_blur.contains(Auto::Window), AppType::Window => theme.frosted_windows && self.auto_blur.contains(Auto::Window),