fix blank screen when reopening window on macos
This commit is contained in:
parent
ed8e5e69ba
commit
493b81875a
1 changed files with 21 additions and 20 deletions
|
@ -67,8 +67,8 @@ if (store.get('ignore_ssl')) {
|
||||||
|
|
||||||
// From https://github.com/tutao/tutanota/commit/92c6ed27625fcf367f0fbcc755d83d7ff8fde94b
|
// From https://github.com/tutao/tutanota/commit/92c6ed27625fcf367f0fbcc755d83d7ff8fde94b
|
||||||
if (isLinux() && !process.argv.some((a) => a.startsWith('--password-store='))) {
|
if (isLinux() && !process.argv.some((a) => a.startsWith('--password-store='))) {
|
||||||
const paswordStore = store.get('password_store', 'gnome-libsecret') as string;
|
const passwordStore = store.get('password_store', 'gnome-libsecret') as string;
|
||||||
app.commandLine.appendSwitch('password-store', paswordStore);
|
app.commandLine.appendSwitch('password-store', passwordStore);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mainWindow: BrowserWindow | null = null;
|
let mainWindow: BrowserWindow | null = null;
|
||||||
|
@ -210,7 +210,7 @@ const createTray = () => {
|
||||||
|
|
||||||
const createWindow = async (first = true) => {
|
const createWindow = async (first = true) => {
|
||||||
if (isDevelopment) {
|
if (isDevelopment) {
|
||||||
await installExtensions();
|
await installExtensions().catch(console.log);
|
||||||
}
|
}
|
||||||
|
|
||||||
const nativeFrame = store.get('window_window_bar_style') === 'linux';
|
const nativeFrame = store.get('window_window_bar_style') === 'linux';
|
||||||
|
@ -258,7 +258,6 @@ const createWindow = async (first = true) => {
|
||||||
...(nativeFrame && isWindows() && nativeFrameConfig.windows),
|
...(nativeFrame && isWindows() && nativeFrameConfig.windows),
|
||||||
});
|
});
|
||||||
|
|
||||||
// From https://github.com/electron/electron/issues/526#issuecomment-1663959513
|
|
||||||
const bounds = store.get('bounds') as Rectangle | undefined;
|
const bounds = store.get('bounds') as Rectangle | undefined;
|
||||||
if (bounds) {
|
if (bounds) {
|
||||||
const screenArea = screen.getDisplayMatching(bounds).workArea;
|
const screenArea = screen.getDisplayMatching(bounds).workArea;
|
||||||
|
@ -312,7 +311,6 @@ const createWindow = async (first = true) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('app-restart', () => {
|
ipcMain.on('app-restart', () => {
|
||||||
// Fix for .AppImage
|
|
||||||
if (process.env.APPIMAGE) {
|
if (process.env.APPIMAGE) {
|
||||||
app.exit();
|
app.exit();
|
||||||
app.relaunch({
|
app.relaunch({
|
||||||
|
@ -364,20 +362,6 @@ const createWindow = async (first = true) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle('open-item', async (_event, path: string) => {
|
|
||||||
return new Promise<void>((resolve, reject) => {
|
|
||||||
access(path, constants.F_OK, (error) => {
|
|
||||||
if (error) {
|
|
||||||
reject(error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
shell.showItemInFolder(path);
|
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
const globalMediaKeysEnabled = store.get('global_media_hotkeys', true) as boolean;
|
const globalMediaKeysEnabled = store.get('global_media_hotkeys', true) as boolean;
|
||||||
|
|
||||||
if (globalMediaKeysEnabled) {
|
if (globalMediaKeysEnabled) {
|
||||||
|
@ -487,7 +471,7 @@ const createWindow = async (first = true) => {
|
||||||
const menuBuilder = new MenuBuilder(mainWindow);
|
const menuBuilder = new MenuBuilder(mainWindow);
|
||||||
menuBuilder.buildMenu();
|
menuBuilder.buildMenu();
|
||||||
|
|
||||||
// Open urls in the user's browser
|
// Open URLs in the user's browser
|
||||||
mainWindow.webContents.setWindowOpenHandler((edata) => {
|
mainWindow.webContents.setWindowOpenHandler((edata) => {
|
||||||
shell.openExternal(edata.url);
|
shell.openExternal(edata.url);
|
||||||
return { action: 'deny' };
|
return { action: 'deny' };
|
||||||
|
@ -670,3 +654,20 @@ if (!singleInstance) {
|
||||||
})
|
})
|
||||||
.catch(console.log);
|
.catch(console.log);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Register 'open-item' handler globally, ensuring it is only registered once
|
||||||
|
if (!ipcMain.eventNames().includes('open-item')) {
|
||||||
|
ipcMain.handle('open-item', async (_event, path: string) => {
|
||||||
|
return new Promise<void>((resolve, reject) => {
|
||||||
|
access(path, constants.F_OK, (error) => {
|
||||||
|
if (error) {
|
||||||
|
reject(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
shell.showItemInFolder(path);
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
Reference in a new issue