armcord/src/tray.ts

39 lines
914 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'
2022-02-26 21:26:16 +00:00
import { createSettingsWindow } from './settings/main';
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();
},
},
2022-02-26 21:26:16 +00:00
{
label: "Open Settings",
click: function () {
createSettingsWindow();
},
},
{
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-02-18 20:20:48 +00:00
tray.setToolTip('ArmCord ' + app.getVersion())
tray.setContextMenu(contextMenu)
2022-02-18 20:20:48 +00:00
})