Electron export shell modules which help developers to interact with a desktop environment. Shell functions are available in both Main and Renderer processes but it is recommended to use it from the Main process so that we can better control its use.

Let make a system alert sound using shell modules. In this article, we will use a shell.beep method which prompts the OS to make the system beep.

Here is a simple code to make a beep in main.js file.

const {
} = require('electron')
function createWindow() {
    // Create the browser window.
    mainWindow = new BrowserWindow({
        width: 800,
        height: 600
    // and load the index.html of the app.
        pathname: path.join(__dirname, 'index.html'),
        protocol: 'file:',
        slashes: true
    // Open the DevTools.
    // mainWindow.webContents.openDevTools()
    // Emitted when the window is closed.
    mainWindow.on('closed', function() {
        // Dereference the window object, usually you would store windows
        // in an array if your app supports multi windows, this is the time
        // when you should delete the corresponding element.
        mainWindow = null