function setTrayContextMenu(assistantHotkey, isUpdateReady = false) {
  const trayContextMenu = Menu.buildFromTemplate([
    {
      label: 'Launch Assistant',
      click: () => {
        launchAssistant();
      },
      accelerator: assistantHotkey,
    },
    {
      label: 'Close to Tray',
      click: () => {
        mainWindow.webContents.executeJavaScript(
          'document.querySelector("body").innerHTML = "";',
        );
        setTimeout(() => mainWindow.hide(), 100);
      },
    },
    {
      label: 'Troubleshoot',
      submenu: [
        {
          label: 'Open DevTools',
          click: () => {
            mainWindow.webContents.openDevTools({ mode: 'undocked' });
          },
        },
        {
          label: (!isFallbackMode())
            ? 'Restart session with default settings (fallback)'
            : 'Revert session back to normal mode',
          click: () => {
            if (!isFallbackMode()) {
              restartInFallbackMode();
            }
            else {
              restartInNormalMode();
            }
          },
        },
        {
          label: 'Check FAQ',
          click: () => {
            electronShell.openExternal(
              `${repoUrl}/wiki/Frequently-Asked-Questions-(FAQ)`,
            );
          },
        },
        {
          label: 'Reveal main process logs in folder',
          click: () => {
            electronShell.showItemInFolder(logFilePath);
          },
        },
      ],
    },
    {
      label: 'Quit',
      click: () => {
        quitApp();
      },
    },
    {
      type: 'separator',
    },
    {
      label: `v${electron.app.getVersion()}`,
      enabled: false,
    },
  ]);

  if (isUpdateReady) {
    trayContextMenu.insert(
      trayContextMenu.items.length - 1,
      new MenuItem({
        label: 'Update and Quit',
        click: () => {
          updater.installUpdateAndQuit();
        },
      }),
    );

    trayContextMenu.insert(
      trayContextMenu.items.length - 1,
      new MenuItem({
        label: 'Update and Restart',
        click: () => {
          updater.installUpdateAndRestart();
        },
      }),
    );
  }

  tray.setContextMenu(trayContextMenu);
}
Builds and binds context menu to the tray.

@param {string} assistantHotkey
Accelerator for assistant hotkey. Used for showing the
accelerator alongside the "Launch Assistant" label.

@param {boolean} isUpdateReady
If set to `true`, the update related options in the
context menu will be set.