resizeWindow() { let setSize = (w, h) => localStorage.setItem('window', JSON.stringify({ width: w, height: h })); let win = remote.getCurrentWindow(); let lastWindow = JSON.parse(localStorage.getItem('window')); let [width, height] = win.getSize(); if(!lastWindow) { setSize(width, height) } else { try { win.setSize(lastWindow.width, lastWindow.height); } catch(e) {} } win.on('resize', () => { let [width, height] = remote.getCurrentWindow().getSize(); setSize(width, height); }); }
windowCount += 1; mainWindow.on('closed',() => windowCache[id] = menuManagerCache[id] = null); mainWindow.on('close', onCloseWindow); mainWindow.on('focus', onFocusWindow); mainWindow.on('unresponsive', onUnresponsiveWindow) mainWindow.flashFrame(true); mainWindow.webContents.on('did-finish-load', () => { let totalActiveWindows = _.keys(windowCache).length; if(totalActiveWindows > 1) { mainWindow.webContents.on('crashed', onCrashedWindow);
}); win.on('close', (e) => { if (!isQuitting) { e.preventDefault();
// On close this.object.on('closed', function(){ console.log('Window "' + instance.name + '" was closed'); // Delete the reference on the windowManager object delete windowManager.windows[instance.name]; // Delete the window object instance.object = null; instance = null; });
createWindow () { this.mainWindow = new BrowserWindow({ width: 1920, height: 1080 }) this.mainWindow.loadURL(this.winURL) this.mainWindow.on('closed', () => { this.mainWindow = null }) }
document.addEventListener('DOMContentLoaded', () => { const serviceListElement = document.getElementById('service-list'); const serviceList = new ServiceList(serviceListElement); serviceList.load(); resizeWindow(); document.getElementById('quit').addEventListener('click', () => { remote.app.quit(); }); window.on('show', () => { serviceList.load(); resizeWindow(); }); });
//leave-full-screen mainWindow.on('leave-full-screen', () => { if (view.length>0){ view[activeview].setBounds({ x: 0, y: 76, width: mainWindow.getBounds().width, height: mainWindow.getBounds().height -76}) } })
export function create(opts) { count += 1; let win = new BrowserWindow(opts); win.on('close', () => { count -= 1; win = null; }); return win; }
mainWindow.on('page-title-updated', (e, title) => { if (mainWindow === null) { return; } e.preventDefault(); if (!title.endsWith('Lightcord')) { title += ' - Lightcord'; } mainWindow.setTitle(title); });
mainWindow.on('leave-html-full-screen', () => { // fixes a bug wherein embedded videos returning from full screen cause our menu to be visible. mainWindow.setMenuBarVisibility(false); });
mainWindow.on('blur', () => { webContentsSend('MAIN_WINDOW_BLUR'); });
createWindow () { this.mainWindow = new BrowserWindow({ width: 1920, height: 1080 }) this.mainWindow.loadURL(this.winURL) this.mainWindow.on('closed', () => { this.mainWindow = null }) }
mainWindow.on('page-title-updated', (e, title) => { if (mainWindow === null) { return; } e.preventDefault(); if (!title.endsWith('Lightcord')) { title += ' - Lightcord'; } mainWindow.setTitle(title); });
mainWindow.on('leave-html-full-screen', () => { // fixes a bug wherein embedded videos returning from full screen cause our menu to be visible. mainWindow.setMenuBarVisibility(false); });
mainWindow.on('blur', () => { webContentsSend('MAIN_WINDOW_BLUR'); });