In this section, we are going to provide support for saving files to the local filesystem, as well as handling global keyboard shortcuts.
Depending on the platform, you may want to support either Cmd + S for macOS or Ctrl + S for Windows or Linux desktops.
Let's start by switching back to the menu.js file and registering a new global shortcut. The Electron framework is going to handle it regardless of the focused window. It can handle globally registered shortcuts even if no window is present. This is often used when the application provides support for the minimize to tray feature:
- Update the menu.js file and import the globalShortcut object from the Electron framework:
const { globalShortcut } = require('electron'); ...