From 52aa97945b3a0e5ad4ad426b8562e5a480011ae8 Mon Sep 17 00:00:00 2001 From: maciekk64 Date: Fri, 22 Mar 2024 17:34:24 +0100 Subject: [PATCH] feat(time): first_day_of_week config --- cosmic-applet-time/src/config.rs | 2 ++ cosmic-applet-time/src/window.rs | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cosmic-applet-time/src/config.rs b/cosmic-applet-time/src/config.rs index c861f688..97ce9212 100644 --- a/cosmic-applet-time/src/config.rs +++ b/cosmic-applet-time/src/config.rs @@ -5,6 +5,7 @@ use cosmic::cosmic_config::{self, CosmicConfigEntry}; #[version = 1] pub struct TimeAppletConfig { pub military_time: bool, + pub first_day_of_week: u8, pub show_date_in_top_panel: bool, } @@ -12,6 +13,7 @@ impl Default for TimeAppletConfig { fn default() -> Self { Self { military_time: false, + first_day_of_week: 6, show_date_in_top_panel: true, } } diff --git a/cosmic-applet-time/src/window.rs b/cosmic-applet-time/src/window.rs index d3fef494..4061e9cd 100644 --- a/cosmic-applet-time/src/window.rs +++ b/cosmic-applet-time/src/window.rs @@ -317,7 +317,8 @@ impl cosmic::Application for Window { // Calender let mut calender: Grid<'_, Message> = grid().width(Length::Fill); - let mut first_day_of_week = Weekday::Sun; // TODO: Configurable + let mut first_day_of_week = + Weekday::try_from(self.config.first_day_of_week).unwrap_or(Weekday::Sun); for _ in 0..7 { calender = calender.push( text(first_day_of_week)