From 6d099ee2a4c455561f4c6f86ea995df267469eca Mon Sep 17 00:00:00 2001 From: Jason Tsai Date: Tue, 30 Apr 2024 10:26:08 -0500 Subject: [PATCH] fix(macos): fix position of the tray icon to top-left (#149) * fix(macos): fix position of the tray icon to top-left * Update .changes/fix-macos-tray-item-y-pos.md --------- Co-authored-by: Amr Bashir --- .changes/fix-macos-tray-item-y-pos.md | 5 +++++ src/platform_impl/macos/mod.rs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changes/fix-macos-tray-item-y-pos.md diff --git a/.changes/fix-macos-tray-item-y-pos.md b/.changes/fix-macos-tray-item-y-pos.md new file mode 100644 index 0000000..fc48a98 --- /dev/null +++ b/.changes/fix-macos-tray-item-y-pos.md @@ -0,0 +1,5 @@ +--- +"tray-icon": patch +--- + +On macOS, fix the `y` position of the tray icon to be top-left not bottom-left of the icon. diff --git a/src/platform_impl/macos/mod.rs b/src/platform_impl/macos/mod.rs index fb5cf04..1a866ef 100644 --- a/src/platform_impl/macos/mod.rs +++ b/src/platform_impl/macos/mod.rs @@ -422,7 +422,7 @@ fn get_tray_rect(window: id) -> Rect { .to_physical(scale_factor), position: crate::dpi::LogicalPosition::new( frame.origin.x, - flip_window_screen_coordinates(frame.origin.y), + flip_window_screen_coordinates(frame.origin.y) - frame.size.height, ) .to_physical(scale_factor), }