Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(macos): support to change tray icon aspect ratio, close #564 #565

Merged
merged 4 commits into from
Sep 25, 2022

Conversation

zzzgydi
Copy link
Contributor

@zzzgydi zzzgydi commented Sep 23, 2022

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Docs
  • New Binding issue #___
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes, and the changes were approved in issue #___
  • No

Checklist

  • When resolving issues, they are referenced in the PR's title (e.g fix: remove a typo, closes #___, #___)
  • A change file is added if any packages will require a version bump due to this PR per the instructions in the readme.
  • I have added a convincing reason for adding this feature, if necessary

Other information

@zzzgydi zzzgydi requested a review from a team as a code owner September 23, 2022 05:58
Copy link
Member

@amrbashir amrbashir left a comment

Choose a reason for hiding this comment

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

I think we should just remove the hard-coded values and use the passed image height and width directly without modifications to match other platforms.

@zzzgydi
Copy link
Contributor Author

zzzgydi commented Sep 23, 2022

Will there be a breaking change if we use the icon width and height directly?

@amrbashir
Copy link
Member

No, since other platforms already have this behavior. We just need to confirm that the system_tray example looks the same after/before the change. I mean the icon is not blurry and is not bigger than other tray icons.

@zzzgydi
Copy link
Contributor Author

zzzgydi commented Sep 23, 2022

image

It will bigger than other tray icons on macOS, I think the height should be 18.

@amrbashir
Copy link
Member

amrbashir commented Sep 23, 2022

maybe try keeping the height fixed to 18.0 and calculate the width dynamically based on ratio of the original height to the fixed height so it would be something like this

let height = 18.0;
let width = icon.width / (icon.height / height);

This way it will keep the original behavior and allow you to specify a different width for your icon.

So if you have an icon that is 32Hx120W, you get a 18Hx67W in tray

@amrbashir amrbashir merged commit dbbfd97 into tauri-apps:dev Sep 25, 2022
@github-actions github-actions bot mentioned this pull request Sep 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants