Description
Checklist
- I have searched the issue tracker for open issues that relate to the same feature, before opening a new one.
- This issue only relates to a single feature. I will open new issues for any other features.
Is your feature request related to a problem?
As mentioned in #4548, fyne.io/v2/app
does not support template images which are the recommended format for system tray and menubar icons. This leads to an app that uses out-of-place colored icons or monochromatic icons which do not change in response to the system theme or to accessibility settings that call for high contrast. The only way to partially get this functionality is to import fyne.io/systray
directly and call SetTemplateIcon
, which allows at least the systray icon to be templated, however this does not extend to MenuItem
s.
Is it possible to construct a solution with the existing API?
Only partially (see above).
Describe the solution you'd like to see.
This is a toughie, since icons are only available as fyne.Resource
values. A medium-lift solution could involve adding a TemplatedResource
interface that these images could implement:
package fyne
type TemplatedResource interface {
Resource
Templated() bool
}
Which would require changes to fyne bundle
to accept a flag or a naming convention to embed certain resources with a type conforming to this interface; however a better solution would probably involve deeper changes to fyne bundle
(and resources overall) allowing bundle to detect file types and even embed platform-specific assets following a similar convention to Go build flag suffixes for filenames, such that:
embeds/
myIcon.png
myIcon_mac.png
mySecondIcon.png
mySecondIcon_windows.png
mySecondIcon_mac_templated.png
would result in two resources: resourceMyIcon
, which would be tagged as an image with mac and !mac variants and resourceMySecondIcon
, which would be tagged as an image with windows and templated mac variants and a fallback to be used on other platforms.
This is likely getting into v3 territory, however.
Activity