1
0
Fork 0
mirror of https://github.com/anyproto/anytype-ts.git synced 2025-06-08 05:57:02 +09:00

multiple windows

This commit is contained in:
Andrew Simachev 2022-06-30 15:14:13 +03:00
parent 98b18ea2b5
commit a6480206cd
3 changed files with 43 additions and 36 deletions

View file

@ -107,7 +107,7 @@ nativeTheme.on('updated', () => {
});
function createMainWindow () {
mainWindow = WindowManager.createMain({ withState: true });
mainWindow = WindowManager.createMain({ withState: true, route: Util.getRouteFromUrl(deeplinkingUrl) });
mainWindow.once('ready-to-show', () => {
mainWindow.show();
@ -123,6 +123,27 @@ function createMainWindow () {
);
};
mainWindow.on('close', (e) => {
Util.log('info', 'closeMain: ' + app.isQuiting);
if (app.isQuiting) {
return;
};
e.preventDefault();
if (!is.linux) {
if (win.isFullScreen()) {
win.setFullScreen(false);
win.once('leave-full-screen', () => { win.hide(); });
} else {
win.hide();
};
} else {
this.exit(false);
};
return false;
});
registerIpcEventsMain();
registerIpcEventsWindow();
@ -143,16 +164,7 @@ function createMainWindow () {
};
function createChildWindow (route) {
const win = WindowManager.createMain({ withState: false });
win.once('ready-to-show', () => {
win.show();
if (route) {
Util.send(win, 'route', route);
};
});
WindowManager.createMain({ withState: false, route: route });
registerIpcEventsWindow();
};