fix(#1521): fixed issue related to recent menu being disabled

This commit is contained in:
Anoop M D 2024-02-14 03:06:27 +05:30
parent 8287126deb
commit eab50f01d7

View File

@ -5,6 +5,7 @@ const { BrowserWindow, app, Menu, ipcMain } = require('electron');
const { setContentSecurityPolicy } = require('electron-util');
const menuTemplate = require('./app/menu-template');
const { openCollection } = require('./app/collections');
const LastOpenedCollections = require('./store/last-opened-collections');
const registerNetworkIpc = require('./ipc/network');
const registerCollectionsIpc = require('./ipc/collection');
@ -28,13 +29,13 @@ const contentSecurityPolicy = [
setContentSecurityPolicy(contentSecurityPolicy.join(';') + ';');
const menu = Menu.buildFromTemplate(menuTemplate);
Menu.setApplicationMenu(menu);
let mainWindow;
let watcher;
// Prepare the renderer once the app is ready
app.on('ready', async () => {
Menu.setApplicationMenu(menu);
const { maximized, x, y, width, height } = loadWindowState();
mainWindow = new BrowserWindow({
@ -123,6 +124,7 @@ app.on('ready', async () => {
// Quit the app once all windows are closed
app.on('window-all-closed', app.quit);
// Open collection from Recent menu (#1521)
app.on('open-file', (event, path) => {
openCollection(mainWindow, watcher, path);
})
});