Skip to content

Conversation

@Junseo5
Copy link
Contributor

@Junseo5 Junseo5 commented Jan 5, 2026

Problem

When launching the desktop app on Windows with plugins that take time to load (like oh-my-opencode), multiple instances spawn continuously because there's no single-instance guard. This causes 10+ windows to open.

Solution

Add tauri-plugin-single-instance which:

  • Prevents multiple app instances from running simultaneously
  • Focuses existing window when user tries to launch another instance
  • Unminimizes window if it was minimized

Changes

  • packages/desktop/src-tauri/Cargo.toml: Add tauri-plugin-single-instance = "2"
  • packages/desktop/src-tauri/src/lib.rs: Initialize single-instance plugin with focus handler

Testing

  1. Build desktop app with slow-loading plugins
  2. Try launching app multiple times quickly
  3. Expected: Only one window opens, subsequent launches focus existing window

Fixes #6965

When launching the desktop app while plugins are loading slowly,
multiple instances could spawn because there was no single-instance
guard. This caused 10+ windows to open continuously on Windows.

This fix adds tauri-plugin-single-instance which:
- Prevents multiple app instances from running
- Focuses existing window when user tries to launch another instance
- Unminimizes window if it was minimized

Fixes #XXXX
@Junseo5 Junseo5 requested a review from adamdotdevin as a code owner January 5, 2026 17:14
@github-actions
Copy link
Contributor

github-actions bot commented Jan 5, 2026

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate Found

PR #6926 - "fix(desktop): add single-instance protection to prevent multiple app spawns"
#6926

Why they're related:

Both PRs are addressing the same problem: preventing multiple instances of the desktop app from spawning simultaneously. They appear to be implementing the same solution using the tauri-plugin-single-instance plugin to prevent multiple windows and ensure the existing window is focused when a launch is attempted.

Action required: Check if PR #6926 is already merged or open, and consolidate efforts if both are addressing the same issue.

@adamdotdevin
Copy link
Contributor

cc @Brendonovich

Copy link
Collaborator

@Brendonovich Brendonovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tyvm

@Brendonovich Brendonovich merged commit f510d17 into anomalyco:dev Jan 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Desktop app opens multiple windows on startup (Windows)

3 participants