feat: allow GUID parameter to avoid systray demotion on Windows (#21891)

* fix: systray icon demotion

Adding support for GUID parameter in Tray API.
In combination with signed binaries this allows to maintain
the position in the systray on Windows.

* unit tests

* make mac and linux compile
This commit is contained in:
bitdisaster 2020-01-30 21:37:03 -08:00 committed by GitHub
parent 2955c67c4e
commit 89eb309d0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 143 additions and 15 deletions

View file

@ -58,9 +58,10 @@ If you want to keep exact same behaviors on all platforms, you should not
rely on the `click` event and always attach a context menu to the tray icon.
### `new Tray(image)`
### `new Tray(image, [guid])`
* `image` ([NativeImage](native-image.md) | String)
* `guid` String (optional) _Windows_ - Assigns a GUID to the tray icon. If the executable is signed and the signature contains an organization in the subject line then the GUID is permanently associated with that signature. OS level settings like the position of the tray icon in the system tray will persist even if the path to the executable changes. If the executable is not code-signed then the GUID is permanently associated with the path to the executable. Changing the path to the executable will break the creation of the tray icon and a new GUID must be used. However, it is highly recommended to use the GUID parameter only in conjunction with code-signed executable. If an App defines multiple tray icons then each icon must use a separate GUID.
Creates a new tray icon associated with the `image`.