Share native theme components and fix dialog backdrop blur

Centralize native palettes, presets, typography, controls, menus, calendar rendering, and icon assets in ferese-theme. Reuse the shared components across the shell, settings, lock screen, authentication prompt, and screen-sharing chooser.

Attach themed dialogs to compositor-owned materials, correct backdrop capture and sampling across output transforms, smooth patterned backgrounds, and prevent clipped picker buttons with the configured shell font.
This commit is contained in:
Samuel Onoja committed 2026-09-29 21:19:19 +01:00
1 parent 362bf79012
commit b2363a18b0
85 files changed
+2163 -1591

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
use std::{
collections::HashMap,
sync::{Mutex, OnceLock},
};
pub fn font(family: Option<&str>) -> cosmic::font::Font {
let Some(family) = family else {
return cosmic::font::default();
};
static FONTS: OnceLock<Mutex<HashMap<String, cosmic::font::Font>>> = OnceLock::new();
let mut fonts = FONTS.get_or_init(Default::default).lock().unwrap();
if let Some(font) = fonts.get(family) {
return *font;
}
if fonts.len() >= 64 {
return cosmic::font::default();
}
let name = Box::leak(family.to_owned().into_boxed_str());
let font = cosmic::font::Font::with_name(name);
fonts.insert(family.to_owned(), font);
font
}
/// COSMIC's text helper overrides Settings::default_font; set the Ferese font explicitly.
pub fn text<'a>(
content: impl Into<std::borrow::Cow<'a, str>> + 'a,
font: cosmic::font::Font,
) -> cosmic::widget::Text<'a, cosmic::Theme, cosmic::Renderer> {
cosmic::widget::text(content).font(font)
}