Skip to content

Conversation

@drasticactions
Copy link
Contributor

Fixes #18896

What does the pull request do?

This PR adjusts the scaling behavior for macOS Tray and Menu images to round down the scaling to a whole number.

What is the current behavior?

The logic in menu.mm and tray icon.mm tries to set the height and width of the menu image based on the menu font size. This would, generally, over-scale the image, both cutting it off and making it blurry.

What is the updated/expected behavior with this PR?

I've added a floor to it so now it will scale down to a whole number. This keeps the existing-ish logic and should fix it so it won't be blurry and cut off.

  • Without the change
Without Without-Menu
  • With the change
With With-Menu

The scaling logic can't be fully removed because that would be a breaking change. NSStatusBar does allow for variable size icons that are not square and more could be done to allow for directly setting sizes, but I feel this is the least destructive way to handle it for now that should fix the general issue.

Copy link
Member

@jmacato jmacato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Works great! LGTM!

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 12.0.999-cibuild0058828-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@drasticactions drasticactions added this pull request to the merge queue Sep 12, 2025
@MrJul MrJul added enhancement os-macos backport-candidate-11.3.x Consider this PR for backporting to 11.3 branch labels Sep 12, 2025
Merged via the queue into master with commit 628b9db Sep 12, 2025
12 checks passed
@drasticactions drasticactions deleted the scaling-icon-macos branch September 12, 2025 08:34
MrJul pushed a commit that referenced this pull request Sep 12, 2025
* Set TrayIcon image size to 17, 17

* Use Floor for setting icon size
@MrJul MrJul added backported-11.3.x and removed backport-candidate-11.3.x Consider this PR for backporting to 11.3 branch labels Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS TrayIcon is unexpectedly scaled

5 participants