I'm building an app which should be integrated through an option in the context menu of Windows explorer and Mac finder. I couldn't find a relevant option in Electron's documentation.
For example, when I right-click a file in Windows explorer / Mac finder, I want this option from my Electron app to appear in that menu. Is it possible?
Right-click (or select and hold) on a file or folder to open the context menu. Select Show more options.
const electron = require('electron'); const { app, BrowserWindow, Menu } = electron; let mainWindow; app. on('ready', () => { mainWindow = new BrowserWindow({}); mainWindow. loadURL(`file://${__dirname}/main.html`); const mainMenu = Menu. buildFromTemplate(menuTemplate); Menu.
The only workaround is to use Menu. setApplicationMenu(null) , however, this will disable all the menu shortcuts like F11 for toggling fullscreen etc. In new versions of Electron, you can set autoHideMenuBar: true while creating browserWindow, pressing Alt will show the menu bar again.
This question is not actually related to Electron. It can be divided into two parts:
Windows:
OSX:
Multiple options exist for command line argument parsing in Node.js, here is just a handful I've been using in the past:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With