Skip to content

Commit

Permalink
略微修改细化相关代码
Browse files Browse the repository at this point in the history
  • Loading branch information
Adkinsm2020 committed Nov 27, 2021
1 parent 8acaa4e commit 3351e1f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*eslint-disable no-undef */
const { app, BrowserWindow, Menu, dialog, ipcMain } = require("electron");
const { app, BrowserWindow, Menu, dialog, ipcMain, globalShortcut } = require("electron");
const path = require("path");
const fs = require("fs");

Expand All @@ -9,6 +9,10 @@ Store.initRenderer();

let mainWindow = null;

function toogleDevTools() {
mainWindow.webContents.isDevToolsOpened() ? mainWindow.webContents.closeDevTools() : mainWindow.webContents.openDevTools({ mode: 'detach' });
}

const channelName = "Plugin-Uninstall-All";
function createWindow() {
mainWindow = new BrowserWindow({
Expand Down Expand Up @@ -88,6 +92,10 @@ function createWindow() {
Menu.setApplicationMenu(Menu.buildFromTemplate(template));
*/
//mainWindow.webContents.openDevTools()

globalShortcut.register('Control+Shift+D', () => {
toogleDevTools();
});
}

if (!app.isPackaged) {
Expand Down Expand Up @@ -117,6 +125,7 @@ app.whenReady().then(() => {
});

app.on("window-all-closed", function () {
globalShortcut.unregisterAll();
if (process.platform !== "darwin") app.quit();
});

Expand All @@ -125,7 +134,7 @@ ipcMain.on("errorInRenderer", function (sys, msg) {
});

ipcMain.on("openDevTools", function (sys, msg) {
mainWindow.webContents.isDevToolsOpened() ? mainWindow.webContents.closeDevTools() : mainWindow.webContents.openDevTools({ mode: 'bottom' });
toogleDevTools();
});

ipcMain.on("InstallAllPluginsFromJSONFile", function (sys, msg) {
Expand Down

0 comments on commit 3351e1f

Please sign in to comment.