#14546·SDL

SDL Tray is missing a notification of menu being opened/closed

Author: OndrejKarlikCreated Nov 29, 2025Updated Sep 17, 2026

I wanted to use SDL_Tray over the clunky native win32 code, but I am missing a key feature: being able to tell when the tray is opened/closed. AFAIK there is no way to tell that the menu did open. And if the menu is cancelled (e.g. by clicking outside it), there is no way to tell it closed.

Knowing when the menu is showing is necessary e.g. when it displays changing status info, such as CPU temperatures, download speeds, progress of processing, solar panels instant power, etc. These things are often expensive to query and one does not want to retrieve them unless they are visible to user.

I am thinking about API looking roughly like this:

typedef void (SDLCALL *SDL_TrayMenuShowCallback)(void *userdata, bool opening);
void SDL_SetTrayMenuShowCallback(SDL_TrayMenu *menu, SDL_TrayMenuShowCallback callback, void *userdata);