71 lines
1.3 KiB
JavaScript
71 lines
1.3 KiB
JavaScript
const {app, BrowserWindow, ipcMain, Notification, nativeImage, Tray, Menu} = require("electron")
|
|
const path = require("path")
|
|
const fs = require("fs")
|
|
const ipc = ipcMain
|
|
|
|
|
|
// [Function] Main Window Function
|
|
|
|
function createWindow() {
|
|
const win = new BrowserWindow({
|
|
|
|
width: 300,
|
|
height: 500,
|
|
minWidth: 300,
|
|
minHeight: 500,
|
|
resizable: false,
|
|
movable: true,
|
|
closable: true,
|
|
frame: false,
|
|
icon: path.join(__dirname, './src/logo.ico'),
|
|
title: "Submanager",
|
|
webPreferences: {
|
|
nodeIntegration: true,
|
|
contextIsolation: false,
|
|
devTools: true
|
|
}
|
|
|
|
})
|
|
|
|
win.loadFile("templates/login/login.html")
|
|
|
|
ipc.on("close", () => {
|
|
|
|
app.quit()
|
|
})
|
|
|
|
}
|
|
|
|
app.whenReady().then(() => {
|
|
|
|
const icon = nativeImage.createFromPath('src/logo.png')
|
|
tray = new Tray(icon)
|
|
|
|
|
|
const contextMenu = Menu.buildFromTemplate([
|
|
{ label:"Quitter", click() { app.quit()}}
|
|
])
|
|
|
|
tray.setToolTip("Submanager")
|
|
tray.setContextMenu(contextMenu)
|
|
|
|
//[Operation] - Check settings
|
|
|
|
createWindow()
|
|
|
|
app.on('activate', () => {
|
|
|
|
if(BrowserWindow.getAllWindows().length === 0) {
|
|
createWindow()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|