Closed Ennea closed 3 years ago
Thank you for your report.
I have never seen this myself. Reading the MSDN documentation does not provide any insights either; whatever happens before the event is sent to pystray is out of control of the library.
Does any running applications using the tray change how often this happens?
Hey there, thanks for the reply! I actually fixed this already, but didn't get around to creating a fork/PR yet. In _win32.py
, I changed the _on_notify
to handle WM_RBUTTONUP
instead of WM_RBUTTONDOWN
. This behavior is more correct anyway, and... for some reason unbeknownst to me it also fixes the issue at hand. I looked at a different tray icon library to figure this one out, and it just happened to work.
Sorry for the late reply.
You are absolutely correct that this is the expected behaviour. I have applied these changes to the main branch.
Sometimes when right clicking the tray icon on Windows, the tray context menu is opened above pystray's own menu. I can reproduce this by opening the menu via right click, then dismissing it by left clicking into another application (Firefox in this case, might not work with all applications). Then try opening the menu with a right click again. If it doesn't open the tray context menu as well, dismiss it again by left clicking into another application, and keep doing that until it happens.
Apologies for the wonky reproduction steps, but I couldn't figure out a surefire way to always trigger it. I've also taken a look at pystray's win32 code, but I have no experience with the Windows API and couldn't figure out where this might've gone wrong.