Skip to content

Commit a73ed60

Browse files
Pablo Carmonastarpit
authored andcommitted
add new icons for the tray menu options
1 parent 5e5a417 commit a73ed60

File tree

9 files changed

+49
-5
lines changed

9 files changed

+49
-5
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Icons for OS Tray Menu and main images for CodeFlare brand.
2+
3+
Icons from [FontAwesome](https://fontawesome.com/icons) under [Font Awesome Free License](https://fontawesome.com/license/free)
12.9 KB
Loading
13.1 KB
Loading
15.2 KB
Loading
9.65 KB
Loading
11.6 KB
Loading
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
/** Icon set for the tray menu items */
18+
19+
import { nativeImage } from "electron"
20+
21+
import profile from "@kui-shell/client/icons/png/profileTemplate.png"
22+
import bug from "@kui-shell/client/icons/png/bugTemplate.png"
23+
import powerOff from "@kui-shell/client/icons/png/powerOffTemplate.png"
24+
import play from "@kui-shell/client/icons/png/playTemplate.png"
25+
import stop from "@kui-shell/client/icons/png/stopTemplate.png"
26+
27+
import { join } from "path"
28+
29+
const iconHome = process.env.CODEFLARE_HEADLESS || join(process.argv0, "../../Resources/app/dist/headless")
30+
31+
export const profileIcon = nativeImage.createFromPath(join(iconHome, profile)).resize({ width: 10 })
32+
33+
export const bugIcon = nativeImage.createFromPath(join(iconHome, bug)).resize({ width: 10 })
34+
35+
export const powerOffIcon = nativeImage.createFromPath(join(iconHome, powerOff)).resize({ width: 10 })
36+
37+
export const bootIcon = nativeImage.createFromPath(join(iconHome, play)).resize({ width: 10 })
38+
39+
export const shutDownIcon = nativeImage.createFromPath(join(iconHome, stop)).resize({ width: 10 })

plugins/plugin-codeflare/src/tray/main.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { Menu } from "electron"
2020
import { CreateWindowFunction } from "@kui-shell/core"
2121

2222
import profilesMenu from "./profiles"
23+
import { bugIcon, powerOffIcon } from "./icons"
2324

2425
import { productName } from "@kui-shell/client/config.d/name.json"
2526
import { bugs, version } from "@kui-shell/client/package.json"
@@ -53,8 +54,8 @@ async function buildContextMenu(createWindow: CreateWindowFunction): Promise<Men
5354
}
5455
},
5556
}, */
56-
{ label: `Report a Bug`, click: () => open(bugs.url) },
57-
{ label: `Quit ${productName}`, role: "quit" },
57+
{ label: `Report a Bug`, icon: bugIcon, click: () => open(bugs.url) },
58+
{ label: `Quit ${productName}`, icon: powerOffIcon, role: "quit" },
5859
])
5960

6061
return contextMenu

plugins/plugin-codeflare/src/tray/profiles.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { MenuItemConstructorOptions } from "electron"
1919
import { CreateWindowFunction } from "@kui-shell/core"
2020

2121
import windowOptions from "./window"
22+
import { profileIcon, bootIcon, shutDownIcon } from "./icons"
2223

2324
/** Handler for booting up a profile */
2425
async function boot(profile: string, createWindow: CreateWindowFunction) {
@@ -44,8 +45,8 @@ function submenuForOneProfile(
4445
return {
4546
label: state.profile.name,
4647
submenu: [
47-
{ label: "Boot", click: () => boot(state.profile.name, createWindow) },
48-
{ label: "Shutdown", click: () => shutdown(state.profile.name, createWindow) },
48+
{ label: "Boot", icon: bootIcon, click: () => boot(state.profile.name, createWindow) },
49+
{ label: "Shutdown", icon: shutDownIcon, click: () => shutdown(state.profile.name, createWindow) },
4950
],
5051
}
5152
}
@@ -54,5 +55,5 @@ function submenuForOneProfile(
5455
export default async function profilesMenu(createWindow: CreateWindowFunction): Promise<MenuItemConstructorOptions> {
5556
const profiles = await Profiles.list({})
5657

57-
return { label: "Profiles", submenu: profiles.map((_) => submenuForOneProfile(_, createWindow)) }
58+
return { label: "Profiles", icon: profileIcon, submenu: profiles.map((_) => submenuForOneProfile(_, createWindow)) }
5859
}

0 commit comments

Comments
 (0)