add navbar close & min functionality
This commit is contained in:
parent
ba2826484f
commit
4cf21a0c64
2 changed files with 45 additions and 2 deletions
|
|
@ -31,6 +31,9 @@ let win: BrowserWindow | null;
|
|||
const windowMount = (): void => {
|
||||
backgroundMitt.emit('window-active', true);
|
||||
ipcMain.on('update-recorder', updateRecorder);
|
||||
// handle renderer auth-token event
|
||||
ipcMain.removeHandler('nav-bar'); // avoid setting duplicate handlers
|
||||
ipcMain.handle('nav-bar', navBarHandler);
|
||||
}
|
||||
|
||||
const windowDismount = (): void => {
|
||||
|
|
@ -87,3 +90,14 @@ export const createWindow = async (options: WindowSettings): Promise<void> => {
|
|||
});
|
||||
};
|
||||
|
||||
// call this function on nav bar click
|
||||
function navBarHandler(_event, action: string) {
|
||||
switch(action) {
|
||||
case 'close':
|
||||
if (win) win.close();
|
||||
break;
|
||||
case 'min':
|
||||
if (win) win.minimize();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue