Apply OS theme via native-theme on desktop
This commit is contained in:
@@ -35,6 +35,24 @@ pub fn init(cx: &mut App) {
|
||||
AppSettings::set_global(cx.new(AppSettings::new), cx)
|
||||
}
|
||||
|
||||
/// Read the persisted appearance mode synchronously.
|
||||
///
|
||||
/// The async load fills the global settings later; the native theme must be
|
||||
/// applied before the first window opens, so boot reads the mode straight
|
||||
/// from the settings file instead.
|
||||
pub fn persisted_appearance_mode() -> AppearanceMode {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
let path = config_dir().join(".settings");
|
||||
if let Ok(content) = std::fs::read_to_string(path)
|
||||
&& let Ok(settings) = serde_json::from_str::<Settings>(&content)
|
||||
{
|
||||
return settings.appearance_mode;
|
||||
}
|
||||
}
|
||||
AppearanceMode::default()
|
||||
}
|
||||
|
||||
const DEFAULT_FILE_SERVER: &str = "https://nostr.download/";
|
||||
const LEGACY_FILE_SERVER: &str = "blossom.band";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user