Skip to content

Feature request: single-instance mode (focus existing window when re-launched) #31

Description

@meumeu-dev

Problem

Clicking the Switchboard icon while the app is already running spawns a second instance instead of focusing the existing window.

There are two issues with this:

  1. No real use case — Switchboard is a session manager; having two copies of it open at the same time doesn't give you anything a single window doesn't (sessions, search, terminal, etc. are all the same data).
  2. Performance — each instance is a full Electron process (+ renderer + workers + pty + watchers). Running two in parallel makes the machine noticeably laggy, especially on laptops or lower-end boxes.

Expected behavior

Re-launching Switchboard (clicking the dock/taskbar icon, switchboard from a terminal, etc.) should focus and raise the already-running window instead of spawning a new process.

This is the default pattern for most Electron apps (VS Code, Slack, Discord, Obsidian…) and is what users instinctively expect.

Suggested implementation

Electron ships this out of the box — a few lines in main.js:

const gotTheLock = app.requestSingleInstanceLock();

if (!gotTheLock) {
  app.quit();
} else {
  app.on('second-instance', () => {
    if (mainWindow) {
      if (mainWindow.isMinimized()) mainWindow.restore();
      mainWindow.focus();
    }
  });
}

Docs: https://www.electronjs.org/docs/latest/api/app#apprequestsingleinstancelock

Optional

If some users genuinely want multiple instances (multi-monitor workflows?), it could be guarded behind a setting like allowMultipleInstances: false (default) in preferences. But honestly, single-instance-by-default with no option would already cover 99% of cases.

Thanks for the app! 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions