You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

73 lines
1.7 KiB

const { app, BrowserWindow, globalShortcut, shell, autoUpdater, dialog } = require('electron');
4 years ago
const AutoLaunch = require('auto-launch');
var autoLaunch = new AutoLaunch({
name: 'Keyzo',
path: '/Applications/Keyzo.app',
4 years ago
});
let loadingScreen;
const createLoadingScreen = () => {
loadingScreen = new BrowserWindow({
width: 200,
height: 400,
frame: false,
backgroundColor: '#212121'
});
loadingScreen.setResizable(false);
loadingScreen.on('closed', () => (loadingScreen = null));
loadingScreen.loadFile('public/pages/loadscreen.html')
};
function createWindow() {
const win = new BrowserWindow({
webPreferences: {
nodeIntegration: true,
webviewTag: true,
enableRemoteModule: true
},
frame: false,
backgroundColor: '#212121',
'minWidth': 600,
'minHeight': 600,
})
win.loadFile('public/index.html')
globalShortcut.register('CommandOrControl+I+Shift', () => {
if (win.isFocused()) {
win.webContents.openDevTools()
}
})
win.webContents.on('new-window', function (e, url) {
e.preventDefault();
shell.openExternal(url);
});
win.removeMenu()
win.webContents.on('dom-ready', () => {
if (loadingScreen) {
loadingScreen.close();
}
win.show()
})
}
app.whenReady().then(() => {
createLoadingScreen()
createWindow()
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})