fix ts & pretty

This commit is contained in:
Anton Bracke
2022-02-18 23:03:05 +01:00
parent 635bce8379
commit 4db20eea0a
14 changed files with 407 additions and 427 deletions
+56 -57
View File
@@ -11,70 +11,69 @@ let tray: Tray | undefined;
const assetsDirectory = path.join(__dirname, "..", "assets");
export function getTray() {
return tray;
return tray;
}
export function createTray() {
tray = new Tray(path.join(assetsDirectory, "icons", "logo.png"));
tray = new Tray(path.join(assetsDirectory, "icons", "logo.png"));
const trayContextMenu = Menu.buildFromTemplate([
{
id: "open",
label: "Show / Hide",
click() {
const trayContextMenu = Menu.buildFromTemplate([
{
id: "open",
label: "Show / Hide",
click() {
const mainWindow = getWindow();
if (!mainWindow) {
throw new Error("Main window not found");
}
if (mainWindow.isVisible()) {
mainWindow.hide();
} else {
mainWindow.show();
}
},
},
{
label: "Check for updates",
async click() {
await autoUpdater.manualRequestUpdateCheck();
},
},
{
label: "Open Logs",
click() {
log.openLog();
},
},
{
label: "About",
click() {
showAboutWindow({
icon: path.join(__dirname, "..", "assets", "icons", "logo.png"),
copyright: "Copyright © WorkAdventure",
});
},
},
{
label: "Quit",
click() {
// app.confirmedExitPrompt = true;
app.quit();
},
},
]);
tray.setContextMenu(trayContextMenu);
tray.on("double-click", () => {
const mainWindow = getWindow();
if (!mainWindow) {
throw new Error("Main window not found");
throw new Error("Main window not found");
}
if (mainWindow.isVisible()) {
mainWindow.hide();
} else {
mainWindow.show();
}
},
},
{
label: "Check for updates",
async click() {
await autoUpdater.manualRequestUpdateCheck();
},
},
{
label: "Open Logs",
click() {
log.openLog();
},
},
{
label: "About",
click() {
showAboutWindow({
icon: path.join(__dirname, "..", "assets", "icons", "logo.png"),
copyright: "Copyright © WorkAdventure",
});
},
},
{
label: "Quit",
click() {
app.isQuiting = true;
app.confirmedExitPrompt = true;
app.quit();
},
},
]);
mainWindow.show();
});
tray.setContextMenu(trayContextMenu);
tray.on("double-click", () => {
const mainWindow = getWindow();
if (!mainWindow) {
throw new Error("Main window not found");
}
mainWindow.show();
});
return tray;
return tray;
}