From c845fb42030c1d56c30d522590bc5128b8a9b99b Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Sun, 12 Dec 2021 12:48:42 -0500 Subject: [PATCH] reload n kill on steam --- electron/main.js | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/electron/main.js b/electron/main.js index 8c0d32aa8..fe7f500a9 100644 --- a/electron/main.js +++ b/electron/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow, Menu, globalShortcut, shell } = require("electron"); +const { app, BrowserWindow, Menu, shell } = require("electron"); const greenworks = require("./greenworks"); if (greenworks.init()) { @@ -22,12 +22,6 @@ function createWindow() { win.loadFile("index.html"); win.show(); if (debug) win.webContents.openDevTools(); - globalShortcut.register("f5", function () { - win.loadFile("index.html"); - }); - globalShortcut.register("f8", function () { - win.loadFile("index.html", { query: { noScripts: "true" } }); - }); win.webContents.on("new-window", function (e, url) { // make sure local urls stay in electron perimeter @@ -55,6 +49,25 @@ function createWindow() { { label: "Select All", accelerator: "CmdOrCtrl+A", selector: "selectAll:" }, ], }, + { + label: "reloads", + submenu: [ + { + label: "reload", + accelerator: "f5", + click: () => { + win.loadFile("index.html"); + }, + }, + { + label: "reload & kill all scripts", + click: () => { + win.webContents.forcefullyCrashRenderer(); + setTimeout(() => win.loadFile("index.html", { query: { noScripts: "true" } }), 5000); + }, + }, + ], + }, ]), );