tauri-apps / tray-icon

Tray icons for Desktop Applications.
Apache License 2.0
183 stars 27 forks source link

macOS: Incorrect tray icon size #133

Closed pronebird closed 2 months ago

pronebird commented 2 months ago

Hi,

I have played a bit with the new tray API on 13.1 which was migrated from Rectangle to tauri::Rect. I found that it's basically broken, see the click event dump:

TrayIconEvent {
  id: TrayIconId("main"), 
  position: PhysicalPosition { x: 1237.8192138671875, y: 11.752716064453125 }, 
  icon_rect: Rect { position: Physical(PhysicalPosition { x: 2450, y: 48 }), 
  size: Physical(PhysicalSize { width: 2450, height: 2052 }) 
}

The value for tray size is extremely large and it makes no sense.

amrbashir commented 2 months ago

What's your OS?

pronebird commented 2 months ago

@amrbashir macOS. I found the bug, you use origin.{x,y} instead of size.{width, height} when creating the icon size in the on_tray_click() function. I'll send PR in a sec