From 9db703eb591a0539ea0b43643284d78096f28a7f Mon Sep 17 00:00:00 2001 From: coolGi Date: Thu, 26 Sep 2024 16:52:07 +0930 Subject: [PATCH 1/3] made date format in vertical mode look better --- cosmic-applet-time/src/window.rs | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/cosmic-applet-time/src/window.rs b/cosmic-applet-time/src/window.rs index 0ade58e8..fef905b7 100644 --- a/cosmic-applet-time/src/window.rs +++ b/cosmic-applet-time/src/window.rs @@ -478,17 +478,19 @@ impl cosmic::Application for Window { let mut elements = Vec::new(); if self.config.show_date_in_top_panel { - let mut date_bag = Bag::empty(); - - date_bag.day = Some(components::Day::NumericDayOfMonth); - date_bag.month = Some(components::Month::Short); - - let formated = self.format(date_bag, &self.now); - - for p in formated.split_whitespace() { - elements.push(self.core.applet.text(p.to_owned()).into()); - } - + elements.push( + self.core + .applet + .text(format!("{:02}", self.now.day())) + .into(), + ); + elements.push( + self.core + .applet + .text(format!("{:02}", self.now.month())) + .into(), + ); + elements.push( horizontal_rule(2) .width(self.core.applet.suggested_size(true).0) From 4dbea64233f998234a083ae4c31cd88ec904a76c Mon Sep 17 00:00:00 2001 From: coolGi Date: Thu, 26 Sep 2024 17:00:06 +0930 Subject: [PATCH 2/3] fixed seconds not showing on the time applet's vertical mode --- cosmic-applet-time/src/window.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cosmic-applet-time/src/window.rs b/cosmic-applet-time/src/window.rs index fef905b7..80fe8af4 100644 --- a/cosmic-applet-time/src/window.rs +++ b/cosmic-applet-time/src/window.rs @@ -490,7 +490,7 @@ impl cosmic::Application for Window { .text(format!("{:02}", self.now.month())) .into(), ); - + elements.push( horizontal_rule(2) .width(self.core.applet.suggested_size(true).0) @@ -502,6 +502,10 @@ impl cosmic::Application for Window { time_bag.hour = Some(components::Numeric::Numeric); time_bag.minute = Some(components::Numeric::Numeric); + time_bag.second = self + .config + .show_seconds + .then_some(components::Numeric::Numeric); let hour_cycle = if self.config.military_time { preferences::HourCycle::H23 From b8787d6892d430295c86973b5b686b70c53f5052 Mon Sep 17 00:00:00 2001 From: coolGi Date: Thu, 26 Sep 2024 17:07:02 +0930 Subject: [PATCH 3/3] swapped day & month positions on the vertical layout --- cosmic-applet-time/src/window.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cosmic-applet-time/src/window.rs b/cosmic-applet-time/src/window.rs index 80fe8af4..5ceb3cbc 100644 --- a/cosmic-applet-time/src/window.rs +++ b/cosmic-applet-time/src/window.rs @@ -481,13 +481,13 @@ impl cosmic::Application for Window { elements.push( self.core .applet - .text(format!("{:02}", self.now.day())) + .text(format!("{:02}", self.now.month())) .into(), ); elements.push( self.core .applet - .text(format!("{:02}", self.now.month())) + .text(format!("{:02}", self.now.day())) .into(), );