ipcMain.on('rename', (event, itemPath, newName) => { fs.rename(itemPath, path.join(path.dirname(itemPath), newName), (err) => { if(err) console.log(err); }); });
ipcMain.on('bg_text_color', function() { tray.destroy(); createKey(); createTray(); if (desktopWindow != null) { desktopWindow.webContents.send('bg_text_color', 'ping'); } if (desktopBarWindow != null) { desktopBarWindow.webContents.send('bg_text_color', 'ping'); } })
ipcMain.on('application:dock-message-notification', function(event, id) { dockNotificationCache[id] = dockNotificationCache[id] + 1; if (process.platform === 'darwin' || (process.platform === 'linux' && app.isUnityRunning && app.isUnityRunning())) { app.setBadgeCount(dockNotificationCache[id]); } if (process.platform === 'darwin') { app.dock.bounce(); } });
ipcMain.on('application:history-aggressive', (event, flag) => { if(!flag) { return; } let {id} = BrowserWindow.getFocusedWindow(); let cache = windowCache[id]; if(cache.history && cache.history.length) { saveHistory(null, cache.history); cache.history = []; } });
ipcMain.on('createItem', (event, dirPath, name, type) => { if (type === 'file') { fs.writeFile(path.join(dirPath, name), '', err => { if (err) console.log(err); }); } else { fs.mkdir(path.join(dirPath, name), err => { if (err) console.log(err); }); } });
ipcMain.on('application:open-sync-resource', (event, options) => { event.returnValue = dialog.showOpenDialog(BrowserWindow.getFocusedWindow(), options) || []; });
ipcMain.on("quitApp", function() { downloadsSaved = true; app.quit(); });
ipcMain.on('application:history-append', (event, cmd = '') => { if(!cmd) { return; } let {id} = BrowserWindow.getFocusedWindow(); let cache = windowCache[id]; if(!cache.history) { cache.history = []; } cache.history.push(cmd); });
//ipcMain listeners ipcMain.on('openSimulator', (event) => { simulator(); });
ipcMain.on('openInWindow', () => { // console.log('firing inWindowSimulator') InWindowSimulator(); })
ipcMain.on('application:message-box', function(event, options) { dialog.showMessageBox(BrowserWindow.getFocusedWindow(), options); });
ipcMain.on('jump_page', function() { NextPage(); })
ipcMain.on('closeSim', (event, pid) => { closeSim(pid); });
ipcMain.on('delete', (event, itemPath) => { deleteItem(itemPath); });
ipcMain.on('start simulator', ()=> { windowSimulator(); });