armcord/src/tray.ts

39 lines
1 KiB
TypeScript
Raw Normal View History

2022-03-04 17:53:18 +00:00
import {app, Menu, Tray} from "electron";
import {mainWindow} from "./window";
import * as path from "path";
import {createSettingsWindow} from "./settings/main";
let tray = null;
app.whenReady().then(() => {
2022-03-04 17:53:18 +00:00
tray = new Tray(path.join(__dirname, "../", "/assets/ac_plug.png"));
const contextMenu = Menu.buildFromTemplate([
{
label: "Open ArmCord",
click: function () {
mainWindow.show();
}
},
{
label: "Open Settings",
click: function () {
createSettingsWindow();
}
},
{
label: "Support Discord Server",
click: function () {
mainWindow.show();
2022-03-05 17:07:07 +00:00
mainWindow.loadURL("https://discord.gg/TnhxcqynZ2");
2022-03-04 17:53:18 +00:00
}
},
{
label: "Quit ArmCord",
click: function () {
app.quit();
}
}
]);
tray.setToolTip("ArmCord " + app.getVersion());
tray.setContextMenu(contextMenu);
});