T20: on Wayland the window asks for ext_background_effect_v1 on its surface, through a guest connection on gpui's display; one region wider than any window, which the compositor clips, comes and goes with Blurred; the log names the way blur goes; a wayland-server compositor tests it, and scripts/linux.sh runs the tests on Linux in a container
CI / platforms (windows-latest) (push) Failing after 9s
CI / macos (push) Failing after 8m24s
CI / platforms (ubuntu-24.04) (push) Canceled after 0s

This commit is contained in:
ZacharyZhang-NY committed 2026-10-15 00:42:30 -04:00
1 parent 6523632ade
commit 107069b3c8
8 files changed
+529 -13

No files matched your search

+34 -5
View File
@@ -2,6 +2,9 @@ use gpui::{Window, WindowBackgroundAppearance};
use crate::settings::Settings;
#[cfg(target_os = "linux")]
mod wayland;
/// What the window shows of the desktop: blurred or clear while the background lets it through.
pub fn appearance(settings: &Settings) -> WindowBackgroundAppearance {
if settings.background_opacity >= 1.0 {
@@ -13,13 +16,39 @@ pub fn appearance(settings: &Settings) -> WindowBackgroundAppearance {
}
}
/// Sets `window` to what the settings ask when it differs from `shown`; logs the way taken.
pub fn follow(window: &Window, shown: &mut WindowBackgroundAppearance, settings: &Settings) {
let wanted = appearance(settings);
if wanted != *shown {
*shown = wanted;
/// What the main window shows of the desktop, as last set, and on Wayland the blur behind its surface.
pub struct Blur {
shown: WindowBackgroundAppearance,
#[cfg(target_os = "linux")]
wayland: Option<wayland::Effect>,
}
impl Blur {
/// The window as `WindowOptions` opened it from these settings.
pub fn new(window: &Window, settings: &Settings) -> Self {
let shown = appearance(settings);
#[cfg(not(target_os = "linux"))]
let _ = window;
Self {
shown,
#[cfg(target_os = "linux")]
wayland: wayland::Effect::on(window, shown == WindowBackgroundAppearance::Blurred),
}
}
/// Sets the window to what the settings ask when it differs from what it shows; logs the way taken.
pub fn follow(&mut self, window: &Window, settings: &Settings) {
let wanted = appearance(settings);
if wanted == self.shown {
return;
}
self.shown = wanted;
window.set_background_appearance(wanted);
log::info!("blur: the window is {wanted:?} on {}", std::env::consts::OS);
#[cfg(target_os = "linux")]
if let Some(effect) = &self.wayland {
effect.blur(wanted == WindowBackgroundAppearance::Blurred);
}
}
}