1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- import { LOAD_URL } from "./../config";
- import { app, Menu, ipcMain } from 'electron'
- const isdev = process.env.NODE_ENV == "development"
- const loadURL = isdev
- ? `${process.env.WEBPACK_DEV_SERVER_URL}#/settingwin`
- : `${LOAD_URL}#settingwin`;
- const iconSrc = __static + "/images/icon.ico";
- // console.log(loadURL)
- let settingWindow = null;
- const createSettingwin = function (BrowserWindow) {
- if (settingWindow !== null) {
- return false
- }
- let obj = {
- title: '星空路人-设置',
- icon: iconSrc,
- height: 160,
- width: 300,
- show: true,
- titleBarStyle: "hiddenInset",
- frame: true,
- fullscreenable: false,
- minimizable: false,
- maximizable: false,
- transparent: false,
- skipTaskbar: false, // 任务栏中不显示窗口
- closable: true,
- autoHideMenuBar: true,
- enableLargerThanScreen: false,
- resizable: isdev,
- // transparent: process.platform !== "linux",
- hasShadow: process.platform !== "darwin",
- alwaysOnTop: true,
- webPreferences: {
- devTools: false,
- contextIsolation: false,
- sandbox: false,
- nodeIntegration: true,
- enableRemoteModule: true,
- }
- };
- settingWindow = new BrowserWindow(obj);
- Menu.setApplicationMenu(null)
- settingWindow.loadURL(loadURL);
- if (process.env.WEBPACK_DEV_SERVER_URL) {
- settingWindow.webContents.openDevTools();
- }
- settingWindow.on("close", () => {
- settingWindow = null;
- });
- ipcMain.on("window-reset", () => {
- if (!isdev) {
- app.relaunch()
- app.exit()
- }
- });
- // return settingWindow;
- };
- export default createSettingwin;
|