fix(time): improve display of time
This commit is contained in:
parent
0b536349cb
commit
58a61b7eee
1 changed files with 9 additions and 17 deletions
|
|
@ -433,26 +433,20 @@ impl cosmic::Application for Window {
|
||||||
);
|
);
|
||||||
|
|
||||||
let button = cosmic::widget::button(if horizontal {
|
let button = cosmic::widget::button(if horizontal {
|
||||||
let mut time: Vec<Cow<'static, str>> = Vec::new();
|
let mut bag = Bag::empty();
|
||||||
|
|
||||||
if self.config.show_date_in_top_panel {
|
if self.config.show_date_in_top_panel {
|
||||||
let mut date_bag = Bag::empty();
|
|
||||||
|
|
||||||
if self.config.show_weekday {
|
if self.config.show_weekday {
|
||||||
date_bag.weekday = Some(components::Text::Short);
|
bag.weekday = Some(components::Text::Short);
|
||||||
}
|
}
|
||||||
|
|
||||||
date_bag.day = Some(components::Day::NumericDayOfMonth);
|
bag.day = Some(components::Day::NumericDayOfMonth);
|
||||||
date_bag.month = Some(components::Month::Long);
|
bag.month = Some(components::Month::Long);
|
||||||
|
|
||||||
time.push(format!("{} ", self.format(date_bag, &self.now)).into());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut time_bag = Bag::empty();
|
bag.hour = Some(components::Numeric::Numeric);
|
||||||
|
bag.minute = Some(components::Numeric::Numeric);
|
||||||
time_bag.hour = Some(components::Numeric::Numeric);
|
bag.second = self
|
||||||
time_bag.minute = Some(components::Numeric::Numeric);
|
|
||||||
time_bag.second = self
|
|
||||||
.config
|
.config
|
||||||
.show_seconds
|
.show_seconds
|
||||||
.then_some(components::Numeric::Numeric);
|
.then_some(components::Numeric::Numeric);
|
||||||
|
|
@ -463,13 +457,11 @@ impl cosmic::Application for Window {
|
||||||
preferences::HourCycle::H12
|
preferences::HourCycle::H12
|
||||||
};
|
};
|
||||||
|
|
||||||
time_bag.preferences = Some(preferences::Bag::from_hour_cycle(hour_cycle));
|
bag.preferences = Some(preferences::Bag::from_hour_cycle(hour_cycle));
|
||||||
|
|
||||||
time.push(self.format(time_bag, &self.now).into());
|
|
||||||
|
|
||||||
Element::from(
|
Element::from(
|
||||||
row!(
|
row!(
|
||||||
self.core.applet.text(time.concat()),
|
self.core.applet.text(self.format(bag, &self.now)),
|
||||||
container(vertical_space(Length::Fixed(
|
container(vertical_space(Length::Fixed(
|
||||||
(self.core.applet.suggested_size(true).1
|
(self.core.applet.suggested_size(true).1
|
||||||
+ 2 * self.core.applet.suggested_padding(true))
|
+ 2 * self.core.applet.suggested_padding(true))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue