fix(status-area): constrain menu icon-data to icon size - #1466
Open
RafaelKr wants to merge 1 commit into
Open
Conversation
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) <noreply@anthropic.com>
RafaelKr
force-pushed
the
fix/status-area-menu-icon-size
branch
from
July 7, 2026 07:15
7b24325 to
6b925b7
Compare
|
Any chance this could get a look? |
mmstick
approved these changes
Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1147
Menu-item
icon-data(raw PNG) rendered at its native size, unlike theicon-namebranch which uses.size(14), so apps sending full-resolution pixmaps show oversized icons in the menu.Spec:
com.canonical.dbusmenudefinesicon-dataonly as "PNG data of the icon." — no size, no aspect ratio. It is an item icon just likeicon-name, only delivered as raw bytes. Reference DEs render both sources at the same fixed menu-icon size:libdbusmenuqt,dbusmenuimporter.cpp):icon-name→QIcon::fromThemeandicon-data→QIcon(pixmap)both become a plainQIconon the sameQAction;QMenuthen draws every action icon atQStyle::PM_SmallIconSize.dbusMenu.js):_updateImage()assignsicon-nameandicon-datato the sameSt.Icon(popup-menu-icon), which has one fixed size.This applet's
icon-namebranch already does the same (.size(14)); this change rendersicon-datain that same 14px box (ContentFit::Contain).Alternatives considered — for non-square icons (square icons render 14×14 either way):
height: 14, variable width: fills the row height, but the icon column then varies in width, so labels stop aligning withicon-namerows.height: 14,min-width: 14: would restore that alignment, but iced exposes nomin_widthonimage/container— and even with it, a genuinely wide icon would still exceed 14px and misalign its row.Both alternatives keep a non-square (variable-width) slot, which also deviates from KDE/GNOME (fixed square slot). The chosen fixed 14×14 box keeps every icon row aligned (aspect preserved via
Contain) and matches their square slot.Repro: NetBird's tray menu (0.74.2) ships a 256×256 logo. Note: NetBird 0.75.0 (will be released very soon) is a full UI rework and may not reproduce this.
#1147 has screenshots of the current state (before this fix) and KDE. This fix sizes menu item icons correctly:
