Fix Settings rendering, theme accents and wallpaper loading

This commit is contained in:
Samuel Onoja committed 2026-10-04 12:30:54 +01:00
1 parent 950ba723ab
commit 49e54f9a63
7 files changed
+461 -38

No files matched your search

+2 -7
View File
@@ -16,6 +16,7 @@ mod note_store;
mod notification_ui;
mod notifications;
mod recording;
mod renderer;
mod status;
mod status_ui;
mod system_modal;
@@ -109,13 +110,7 @@ impl From<ShellTheme> for BarMetrics {
}
fn main() -> cosmic::iced::Result {
// Small shell surfaces do not need a second GPU device and shader setup.
// Keep wgpu as a fallback and honor an explicit renderer preference.
if std::env::var_os("ICED_BACKEND").is_none() {
// SAFETY: this is the process entry point, before any worker or
// toolkit threads are started.
unsafe { std::env::set_var("ICED_BACKEND", "tiny-skia,wgpu") };
}
renderer::configure_shell();
cosmic::iced::advanced::graphics::text::font_system()
.write()
+61
View File
@@ -0,0 +1,61 @@
use std::ffi::{OsStr, OsString};
use std::process::Command;
use std::sync::OnceLock;
static APP_BACKEND: OnceLock<Option<OsString>> = OnceLock::new();
/// Called at process entry, before the toolkit or workers start threads.
pub(crate) fn configure_shell() {
let backend = std::env::var_os("ICED_BACKEND");
let use_shell_default = backend.is_none();
APP_BACKEND.set(backend).expect("renderer configured once");
if use_shell_default {
// Small shell surfaces do not need a second GPU device and shader setup.
// SAFETY: main calls this before starting any threads.
unsafe { std::env::set_var("ICED_BACKEND", "tiny-skia,wgpu") };
}
}
pub(crate) fn configure_app(command: &mut Command) {
if let Some(backend) = APP_BACKEND.get() {
apply_app_backend(command, backend.as_deref());
}
}
fn apply_app_backend(command: &mut Command, backend: Option<&OsStr>) {
if let Some(backend) = backend {
command.env("ICED_BACKEND", backend);
} else {
// The shell's automatic software preference must not leak into Settings.
command.env_remove("ICED_BACKEND");
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn settings_does_not_inherit_the_shells_automatic_software_renderer() {
let mut command = Command::new("ferese-settings");
command.env("ICED_BACKEND", "tiny-skia,wgpu");
apply_app_backend(&mut command, None);
assert_eq!(
command.get_envs().find(|(key, _)| *key == "ICED_BACKEND").unwrap().1,
None
);
}
#[test]
fn settings_preserves_explicit_renderer_preferences() {
for backend in ["tiny-skia", "wgpu", "wgpu,tiny-skia"] {
let mut command = Command::new("ferese-settings");
apply_app_backend(&mut command, Some(OsStr::new(backend)));
assert_eq!(
command.get_envs().find(|(key, _)| *key == "ICED_BACKEND").unwrap().1,
Some(OsStr::new(backend))
);
}
}
}
+1
View File
@@ -632,6 +632,7 @@ fn execute(action: &Action, settings: Option<&[String]>) -> Result<(), String> {
command.env("WAYLAND_DISPLAY", display);
}
command.env_remove("FERESE_PUBLIC_WAYLAND_DISPLAY");
crate::renderer::configure_app(&mut command);
let mut child = command.spawn().map_err(|e| e.to_string())?;
thread::spawn(move || {
let _ = child.wait();