feat(config): add CosmicTk config for configuring window controls

This commit is contained in:
Michael Aaron Murphy 2024-03-05 16:05:33 +01:00 committed by Jeremy Soller
parent 912f0665ef
commit 4f07d05ee8
6 changed files with 87 additions and 11 deletions

View file

@ -3,6 +3,7 @@
use std::collections::HashMap;
use crate::config::CosmicTk;
use cosmic_config::CosmicConfigEntry;
use cosmic_theme::ThemeMode;
use iced_core::window::Id;
@ -63,6 +64,9 @@ pub struct Core {
/// Configured theme mode
pub(super) system_theme_mode: ThemeMode,
/// Libcosmic toolkit configuration.
pub(super) toolkit_config: CosmicTk,
pub(super) portal_is_dark: Option<bool>,
pub(super) portal_accent: Option<Srgba>,
@ -101,8 +105,18 @@ impl Default for Core {
system_theme_mode: ThemeMode::config()
.map(|c| {
ThemeMode::get_entry(&c).unwrap_or_else(|(errors, mode)| {
for e in errors {
tracing::error!("{e}");
for why in errors {
tracing::error!(?why, "ThemeMode config entry error");
}
mode
})
})
.unwrap_or_default(),
toolkit_config: CosmicTk::config()
.map(|c| {
CosmicTk::get_entry(&c).unwrap_or_else(|(errors, mode)| {
for why in errors {
tracing::error!(?why, "CosmicTk config entry error");
}
mode
})