From 63292ab74dc8ef9c8d4e04055047c7671554e937 Mon Sep 17 00:00:00 2001 From: Rafael Kraut <14234815+RafaelKr@users.noreply.github.com> Date: Mon, 6 Jul 2026 15:41:53 +0200 Subject: [PATCH] fix(status-area): constrain menu icon-data to icon size Menu items expose their icon as a themed `icon-name` or raw PNG `icon-data`. The named-icon branch renders at a fixed `.size(14)`, but the icon-data branch wrapped the pixmap in a bare `Image` with no size constraint, so it rendered at the PNG's native dimensions. Apps may send full-resolution pixmaps, which then render oversized in the menu. Constrain icon-data to the same 14px box with ContentFit::Contain, matching how KDE (Qt small-icon size) and GNOME (St.Icon popup-menu-icon) render menu item icons. Co-Authored-By: Claude Opus 4.8 (1M context) --- cosmic-applet-status-area/src/components/status_menu.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cosmic-applet-status-area/src/components/status_menu.rs b/cosmic-applet-status-area/src/components/status_menu.rs index e706f37b..a228d745 100644 --- a/cosmic-applet-status-area/src/components/status_menu.rs +++ b/cosmic-applet-status-area/src/components/status_menu.rs @@ -232,7 +232,11 @@ fn layout_view(layout: &Layout, expanded: Option) -> cosmic::Element<'_, Ms } if let Some(icon_data) = i.icon_data() { let handle = iced::widget::image::Handle::from_bytes(icon_data.to_vec()); - children.insert(0, iced::widget::Image::new(handle).into()); + let icon = iced::widget::Image::new(handle) + .width(iced::Length::Fixed(14.0)) + .height(iced::Length::Fixed(14.0)) + .content_fit(iced::core::ContentFit::Contain); + children.insert(0, icon.into()); } else if let Some(icon_name) = i.icon_name() { let icon = cosmic::widget::icon::from_name(icon_name) .size(14)