diff --git a/src/index.ts b/src/index.ts index bb5e9a4..9336936 100644 --- a/src/index.ts +++ b/src/index.ts @@ -638,4 +638,14 @@ ipcMain.handle('open-context-menu', ipcHandler((options: ContextMenuDefinition) )); ipcMain.handle('get-desktop-version', ipcHandler(() => DESKTOP_VERSION)); -ipcMain.handle('get-server-auth-token', ipcHandler(() => AUTH_TOKEN)); \ No newline at end of file +ipcMain.handle('get-server-auth-token', ipcHandler(() => AUTH_TOKEN)); + +let restarting = false; +ipcMain.handle('restart-app', ipcHandler(() => { + if (restarting) return; + restarting = true; + console.log('Restarting...'); + + app.relaunch(); + app.quit(); +})); \ No newline at end of file diff --git a/src/preload.ts b/src/preload.ts index bc3f639..0293bfb 100644 --- a/src/preload.ts +++ b/src/preload.ts @@ -28,5 +28,8 @@ contextBridge.exposeInMainWorld('desktopApi', { selectApplication: () => ipcRenderer.invoke('select-application'), openContextMenu: (options: ContextMenuDefinition) => - ipcRenderer.invoke('open-context-menu', options) + ipcRenderer.invoke('open-context-menu', options), + + restartApp: () => + ipcRenderer.invoke('restart-app') }); \ No newline at end of file