armcord/src/tray.ts

31 lines
761 B
TypeScript
Raw Normal View History

2022-01-15 21:21:51 +00:00
import { app, Menu, Tray } from 'electron';
2022-01-30 19:48:32 +00:00
import {mainWindow} from './window';
2022-01-16 18:07:00 +00:00
import * as path from 'path'
let tray = null
app.whenReady().then(() => {
2022-01-16 18:07:00 +00:00
tray = new Tray(path.join(__dirname, "../", "/assets/ac_plug.png"))
const contextMenu = Menu.buildFromTemplate([
{
label: "Open ArmCord",
click: function () {
mainWindow.show();
},
},
{
label: "Support Discord Server",
click: function () {
mainWindow.show();
mainWindow.loadURL("https://discord.gg/F25bc4RYDt");
},
},
{
label: "Quit ArmCord",
click: function () {
app.quit();
},
},
]);
2022-01-15 21:21:51 +00:00
2022-01-16 18:07:00 +00:00
tray.setToolTip('ArmCord ' + process.env.npm_package_version)
tray.setContextMenu(contextMenu)
})