|
| 1 | +/* |
| 2 | + * Copyright 2022 The Kubernetes Authors |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +import { CreateWindowFunction } from "@kui-shell/core" |
| 18 | + |
| 19 | +import { productName } from "@kui-shell/client/config.d/name.json" |
| 20 | +import { bugs, homepage, version } from "@kui-shell/client/package.json" |
| 21 | + |
| 22 | +import profilesMenu from "./profiles" |
| 23 | +import { bugIcon, powerOffIcon } from "../icons" |
| 24 | + |
| 25 | +/** @return an Electron `Menu` model for our tray menu */ |
| 26 | +export default async function buildContextMenu(createWindow: CreateWindowFunction): Promise<import("electron").Menu> { |
| 27 | + const { Menu } = await import("electron") |
| 28 | + |
| 29 | + const contextMenu = Menu.buildFromTemplate([ |
| 30 | + { label: `Open CodeFlare`, click: () => createWindow([]) }, |
| 31 | + { type: "separator" }, |
| 32 | + await profilesMenu(createWindow), |
| 33 | + { type: "separator" }, |
| 34 | + { label: `Version ${version}`, enabled: false }, |
| 35 | + { label: `Report a Bug`, icon: bugIcon, click: () => import("open").then((_) => _.default(bugs.url)) }, |
| 36 | + { label: `About CodeFlare`, click: () => import("open").then((_) => _.default(homepage)) }, |
| 37 | + { type: "separator" }, |
| 38 | + { label: `Quit ${productName}`, icon: powerOffIcon, role: "quit" }, |
| 39 | + ]) |
| 40 | + |
| 41 | + return contextMenu |
| 42 | +} |
0 commit comments