moses-palmer / pystray

GNU General Public License v3.0
461 stars 57 forks source link

Receive cursor position as an action callback parameter #119

Closed giohappy closed 2 years ago

giohappy commented 2 years ago

AFAICS pystray API doesn't provide a way to obtain the cursor position when the systray icon, or any menu item, is clicked. This information would be precious to be able to position custom windows.

Do you have any plan to expose this information?

moses-palmer commented 2 years ago

Thank you for your report.

Support for this is unfortunately spotty among the various backends, so I have no immediate plans to add this feature.

You may want to have a look at pynput; it will provide you with the cursor position, and you could assume that it had not moved drastically since the menu item was invoked.

giohappy commented 2 years ago

You may want to have a look at pynput; it will provide you with the cursor position, and you could assume that it had not moved drastically since the menu item was invoked.

Nice suggestion. I already have a thread-based architecture with queues, and pynput seems to fit perfectly.