Make full bar clock open calendar

This commit is contained in:
Samuel Onoja committed 2026-09-28 10:05:25 +01:00
1 parent 2bab33758b
commit a72a9e9ae8
1 file changed
+34 -32
+34 -32
View File
@@ -2149,40 +2149,42 @@ impl FereseShell {
.width(Length::Fill) .width(Length::Fill)
.height(bar.control_height); .height(bar.control_height);
let (date, time) = self.clock.split_once(", ").unwrap_or(("", &self.clock)); let (date, time) = self.clock.split_once(", ").unwrap_or(("", &self.clock));
let clock = container( let clock = container(motion::button(
row![ button::custom(
motion::button( row![
button::custom(text(date).size(12)) text(date)
.padding([4, 2]) .size(12)
.name("Open calendar") .class(theme::Text::Color(color(shell_theme.text_muted))),
.on_press_with_rectangle(move |offset, bounds| { text(time)
cosmic::Action::App(Message::OpenMenuOn( .size(bar.text_size)
id, .class(theme::Text::Color(foreground)),
status_ui::Menu::Calendar, ]
cosmic::iced::Rectangle { .spacing(8)
x: (bounds.x - offset.x).round() as i32, .align_y(cosmic::iced::Alignment::Center),
y: (bounds.y - offset.y).round() as i32, )
width: bounds.width.round() as i32, .padding([4, 8])
height: bounds.height.round() as i32, .height(bar.control_height)
}, .name("Open calendar")
)) .on_press_with_rectangle(move |offset, bounds| {
}), cosmic::Action::App(Message::OpenMenuOn(
color(shell_theme.text_muted), id,
self.menu status_ui::Menu::Calendar,
.as_ref() cosmic::iced::Rectangle {
.is_some_and(|menu| menu.kind == status_ui::Menu::Calendar), x: (bounds.x - offset.x).round() as i32,
1.0 y: (bounds.y - offset.y).round() as i32,
), width: bounds.width.round() as i32,
text(time) height: bounds.height.round() as i32,
.size(bar.text_size) },
.class(theme::Text::Color(foreground)), ))
] }),
.spacing(8) foreground,
.align_y(cosmic::iced::Alignment::Center), self.menu
) .as_ref()
.is_some_and(|menu| menu.kind == status_ui::Menu::Calendar),
1.0,
))
.height(bar.control_height) .height(bar.control_height)
.align_y(alignment::Vertical::Center) .align_y(alignment::Vertical::Center)
.padding([0, 8])
.class(theme::Container::custom(move |_| { .class(theme::Container::custom(move |_| {
bar_group_style(shell_theme) bar_group_style(shell_theme)
})); }));