getlantern / systray

a cross platfrom Go library to place an icon and menu in the notification area
Apache License 2.0
3.28k stars 451 forks source link

Dark mode support for windows 11 #257

Open repraze opened 1 year ago

repraze commented 1 year ago

Windows has dark and light mode. Most menus follow system default. It would be great to support this. Potentially as a opt-in to not break other menus with incompatible icons?

Example with task manager

image

image

repraze commented 1 year ago

Implementation should be just an attribute to set True if the preference is there - found a reference to it in https://github.com/neutralinojs/neutralinojs/blob/843fd75e1f4d2766069ff461e25824a125800628/lib/webview/windows/darkmode.h#L62

Relevant API at https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmsetwindowattribute and value at https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute

anacrolix commented 1 year ago

Does MenuItem.SetTemplateIcon help for you here?