Open Semphriss opened 1 year ago
I want to say no here, because this probably either gets watered down to an array of strings that represent possible menu items, or it starts really getting into the specifics of various OSes in ways we don't want to expose in the API.
The API for "system tray" icons on Linux is a bit of a disaster area, even if we assume that a "system tray" is even desirable, which not everyone agrees; so supporting anything non-trivial in a portable way is going to be a struggle.
(Link is from 2019, there has been more recent work but nothing very conclusive)
Yeah, I think this is outside the scope of SDL for now.
Generally speaking, what sorts of idea should I consider worth suggesting to add in SDL?
I have a few changes I'm making for my personal projects and I'd like to contribute them back, but I don't want to flood the issue tracker with my ideas. How should I decide what to share and what not to share?
Feel free to share and we'll let you know if we think it's appropriate. Even if we don't include it in mainline, having it here will let other people find your changes and use them.
For future reference, I managed to implement system trays on Windows, macOS, and Unix.
The source is available at https://github.com/Semphriss/SDL/tree/tray
It supports:
test/trashcan.bmp
as an example)I still have a few rough edges to iron out, but it generally works well at the moment. If anybody would need help to use it, please let me know!
This actually looks pretty good! I'm going to go ahead and reopen this.
Should I open it as a pull request?
Should I open it as a pull request?
Sure!
One thing I expected to see was a show/hide or some way of letting the system know you're done creating the menus. It looks like right now you can keep adding entries over time and they dynamically show up, and if you need to remove one, you have to destroy the tray and start over.
I don't know if you actually need that, just an observation.
One thing I expected to see was a show/hide or some way of letting the system know you're done creating the menus. It looks like right now you can keep adding entries over time and they dynamically show up, and if you need to remove one, you have to destroy the tray and start over.
I haven't created all the possible functions, I went for the easiest path to quick results. AFAIK, all platforms support dynamically removing items at any position, so it's just a matter of adding what's missing.
This actually looks pretty good! I'm going to go ahead and reopen this.
Nothing changes minds faster than working code. :)
Would it be useful to support system tray icons within SDL?
Screenshots for Windows, macOS and Ubuntu
Windows: macOS: Ubuntu:Some potentially useful repositories: