From 586116b78859413dd3ed1a4471fd7c0523085449 Mon Sep 17 00:00:00 2001 From: Pablo Ovelleiro Corral Date: Mon, 27 May 2024 08:43:55 +0200 Subject: [PATCH] Add font configuration settings --- client/src/main.rs | 4 +++- client/src/settings.rs | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/client/src/main.rs b/client/src/main.rs index 268f0e1..8fd714d 100644 --- a/client/src/main.rs +++ b/client/src/main.rs @@ -273,8 +273,10 @@ impl Centerpiece { fn settings(flags: crate::cli::CliArgs) -> iced::Settings { let default_text_size = REM; + let settings = crate::settings::Settings::new(); + let default_font = iced::Font { - family: iced::font::Family::Name("FiraCode Nerd Font"), + family: iced::font::Family::Name(&settings.font.default), weight: iced::font::Weight::Normal, stretch: iced::font::Stretch::Normal, monospaced: true, diff --git a/client/src/settings.rs b/client/src/settings.rs index 2337966..06b1b82 100644 --- a/client/src/settings.rs +++ b/client/src/settings.rs @@ -87,6 +87,11 @@ pub struct GitRepositoriesPluginSettings { pub commands: Vec>, } +#[derive(Debug, Deserialize)] +pub struct FontSettings { + pub default: String, +} + #[derive(Debug, Deserialize)] pub struct ColorSettings { pub text: String, @@ -94,6 +99,14 @@ pub struct ColorSettings { pub surface: String, } +impl Default for FontSettings { + fn default() -> Self { + Self { + default: "FiraCode Nerd Font".to_string(), + } + } +} + impl Default for ColorSettings { fn default() -> Self { Self { @@ -250,6 +263,8 @@ pub struct Settings { pub plugin: PluginSettings, #[serde(default)] pub color: ColorSettings, + #[serde(default)] + pub font: FontSettings, } impl Settings {