feat: add native material backgrounds
This commit is contained in:
@@ -38,6 +38,12 @@ fn home_dir() -> Option<PathBuf> {
|
||||
std::env::var_os("HOME").map(PathBuf::from)
|
||||
}
|
||||
|
||||
/// Whether the session runs on Wayland, where compositors state blur protocols.
|
||||
fn wayland_session() -> bool {
|
||||
std::env::var_os("WAYLAND_DISPLAY").is_some()
|
||||
|| std::env::var("XDG_SESSION_TYPE").is_ok_and(|session| session == "wayland")
|
||||
}
|
||||
|
||||
fn detect(home: &Path, portal_reachable: bool, gsettings_reachable: bool) -> Backend {
|
||||
let omarchy_marker = home
|
||||
.join(".local/state/omarchy/current/theme.name")
|
||||
@@ -164,6 +170,7 @@ impl LinuxSource {
|
||||
.unwrap_or(gpui::px(14.67)),
|
||||
),
|
||||
accessibility,
|
||||
window_background: None,
|
||||
source: SourceKind::Gnome,
|
||||
}
|
||||
}
|
||||
@@ -203,15 +210,24 @@ impl ThemeSource for LinuxSource {
|
||||
|
||||
match self.backend {
|
||||
Backend::Omarchy => omarchy::io::read_current()
|
||||
.map(|theme| theme.into_system(accessibility))
|
||||
.map(|theme| {
|
||||
let mut system = theme.into_system(accessibility);
|
||||
// Hyprland blurs transparent surfaces on its own.
|
||||
system.window_background = Some(gpui::WindowBackgroundAppearance::Blurred);
|
||||
system
|
||||
})
|
||||
.unwrap_or_else(|| SystemTheme::fallback(variant)),
|
||||
Backend::Kde => kde::io::read_current()
|
||||
.map(|scheme| {
|
||||
scheme.into_system(
|
||||
let mut system = scheme.into_system(
|
||||
accessibility,
|
||||
portal_appearance.and_then(|appearance| appearance.accent),
|
||||
portal_appearance.map(|appearance| appearance.variant(variant)),
|
||||
)
|
||||
);
|
||||
// KWin states the blur protocols; X11 compositors do not.
|
||||
system.window_background =
|
||||
wayland_session().then_some(gpui::WindowBackgroundAppearance::Blurred);
|
||||
system
|
||||
})
|
||||
.unwrap_or_else(|| SystemTheme::fallback(variant)),
|
||||
Backend::Portal => self.portal_snapshot(variant, portal_appearance, accessibility),
|
||||
|
||||
Reference in New Issue
Block a user