feat(time): first_day_of_week config

This commit is contained in:
maciekk64 2024-03-22 17:34:24 +01:00 committed by Michael Murphy
parent 51eed6ec12
commit 52aa97945b
2 changed files with 4 additions and 1 deletions

View file

@ -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,
}
}

View file

@ -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)