Extension tray menu items (#4619)

* Add extension ability to add tray menu items.

Signed-off-by: Juho Heikka <juho.heikka@gmail.com>

* Add tray menu extension documentation

Signed-off-by: Juho Heikka <juho.heikka@gmail.com>

* Add tests to tray menu items. Fix autorun infinite loop.

Signed-off-by: Juho Heikka <juho.heikka@gmail.com>

* Fix documentation

Signed-off-by: Juho Heikka <juho.heikka@gmail.com>

* Remove unnecessary slice()

Signed-off-by: Juho Heikka <juho.heikka@gmail.com>

* Define a type for tray menu registration

Signed-off-by: Juho Heikka <juho.heikka@gmail.com>

* Change TrayMenuRegistration not to leak or depend on Electron Menu API

Signed-off-by: Juho Heikka <juho.heikka@gmail.com>

* Update trayMenus Extension API documentation

Signed-off-by: Juho Heikka <juho.heikka@gmail.com>

* Refactor all tests to use runInAction

Signed-off-by: Juho Heikka <juho.heikka@gmail.com>
This commit is contained in:
Juho Heikka authored and GitHub committed 2021-12-31 15:50:01 +02:00
1 parent 58ea0dc822
commit 1db805b451
9 files changed
+298 -23

No files matched your search

@@ -37,9 +37,9 @@ export default class ExampleMainExtension extends Main.LensExtension {
}
```
### App Menus
### Menus
This extension can register custom app menus that will be displayed on OS native menus.
This extension can register custom app and tray menus that will be displayed on OS native menus.
Example:
@@ -56,6 +56,29 @@ export default class ExampleMainExtension extends Main.LensExtension {
}
}
]
trayMenus = [
{
label: "My links",
submenu: [
{
label: "Lens",
click() {
Main.Navigation.navigate("https://k8slens.dev");
}
},
{
type: "separator"
},
{
label: "Lens Github",
click() {
Main.Navigation.navigate("https://github.com/lensapp/lens");
}
}
]
}
]
}
```