diff --git a/cosmic-settings/src/pages/time/date.rs b/cosmic-settings/src/pages/time/date.rs index 67c2242..0c7ba0f 100644 --- a/cosmic-settings/src/pages/time/date.rs +++ b/cosmic-settings/src/pages/time/date.rs @@ -19,6 +19,7 @@ pub struct Page { auto: bool, auto_timezone: bool, military_time: bool, + show_date_in_top_panel: bool, // info: Option, } @@ -29,11 +30,16 @@ impl Default for Page { error!(?err, "Failed to read config 'military_time'"); false }); + let show_date_in_top_panel = config.get("show_date_in_top_panel").unwrap_or_else(|err| { + error!(?err, "Failed to read config 'show_date_in_top_panel'"); + true + }); Self { config, auto: false, auto_timezone: false, military_time, + show_date_in_top_panel, } } } @@ -68,6 +74,12 @@ impl Page { error!(?err, "Failed to set config 'military_time'"); } } + Message::ShowDate(enable) => { + self.show_date_in_top_panel = enable; + if let Err(err) = self.config.set("show_date_in_top_panel", enable) { + error!(?err, "Failed to set config 'show_date_in_top_panel'"); + } + } } } } @@ -77,6 +89,7 @@ pub enum Message { Automatic(bool), AutomaticTimezone(bool), MilitaryTime(bool), + ShowDate(bool), } impl page::AutoBind for Page {} @@ -109,6 +122,7 @@ fn format() -> Section { .descriptions(vec![ fl!("time-format", "twenty-four").into(), fl!("time-format", "first").into(), + fl!("time-format", "show-date").into(), ]) .view::(|_binder, page, section| { settings::view_section(§ion.title) @@ -122,6 +136,11 @@ fn format() -> Section { &*section.descriptions[1], horizontal_space(Length::Fill), )) + // Date on top panel toggle + .add( + settings::item::builder(&*section.descriptions[2]) + .toggler(page.show_date_in_top_panel, Message::ShowDate), + ) .apply(cosmic::Element::from) .map(crate::pages::Message::DateAndTime) }) diff --git a/i18n/en/cosmic_settings.ftl b/i18n/en/cosmic_settings.ftl index 40a560f..5dd5753 100644 --- a/i18n/en/cosmic_settings.ftl +++ b/i18n/en/cosmic_settings.ftl @@ -293,6 +293,7 @@ time-zone = Time Zone time-format = Date & Time Format .twenty-four = 24-hour time .first = First day of week + .show-date = Show Date on Top Panel time-region = Region & Language .desc = Format dates, times, and numbers based on your region diff --git a/i18n/pl/cosmic_settings.ftl b/i18n/pl/cosmic_settings.ftl index 357e9b4..3898ecb 100644 --- a/i18n/pl/cosmic_settings.ftl +++ b/i18n/pl/cosmic_settings.ftl @@ -298,6 +298,7 @@ time-zone = Strefa Czasowa time-format = Format Daty i Czasu .twenty-four = Czas 24-godzinny .first = Pierwszy dzień tygodnia + .show-date = Pokaż Datę w Górnym Panelu time-region = Region i Język .desc = Format dat, czasu i numerów na podstawie wybranego regionu