moses-palmer / pystray

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

Notifications don't work on Windows 11 #112

Closed giohappy closed 2 years ago

giohappy commented 2 years ago

I have an application where notifications work perfectly on Window 10 (Python 3.9.10), while they are not showing up when run on Windows 11. No error is thrown, and the _win32._notify() is called without throwing any exception.

It looks like a small square area appears for a tiny fraction of time, as it can be hardly seen in the video below.

I have Windows 11 with the default settings. Notifications are active, and although not required, I've also turned on "Show Icon and notifications" for my app through the "Notification Area Icons" settings (which is hidden on Windows 11 but it can be accessed executing shell:::{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9}).

notification_glitch

giohappy commented 2 years ago

After testing the win32 shell API from another language and library, and noticing that notifications weren't shown, I've discovered that Windows 11 has another configuration for the notifications, that is reached directly right clicking the systray area. These notification settings have precedence over the ones set inside "Notification Area Icons".

After enabling notifications from there I was able to show the notification message.