Skip to content

Application: One instance on Windows and Linux #1384

Closed

Description

@oneo-me

Context

Part of #1306. The roadmap's Application and windows section lists this item (line 151 of docs/roadmap.md at f7fc2f5c) with no issue.

Reference: A named mutex and pipe; a Unix socket; NSH's #1563

Acceptance

  • A second launch hands its arguments to the running app, which hears OnReopen, and the files it names OnOpenFiles; the mutex/pipe and socket handoff is implemented, and nsgo.InstanceKey scopes it so separate profiles or test runs each own one, while surfaces, tray icons and global shortcuts remain

For: 开发@柚子

Activity

  1. added
    enhancement
    on Nov 21, 2026
  2. self-assigned this
    on Nov 22, 2026
  3. houko commented on Nov 22, 2026

    @houko
    Collaborator

    Audited current main ab9bfd1 against this acceptance. The requested single-instance behavior is already implemented:

    • nsgo.InstanceKey scopes the app ID's lock/channel; the default and distinct profile keys can own separate instances.
    • Linux Run claims its private flock/Unix socket before starting GTK or the engine; Windows Run claims its session-scoped named mutex/pipe before creating the app. A later launch hands over and returns early.
    • Both backends route the received launch to EventReopen / OnReopen, file arguments to EventOpenFiles / OnOpenFiles, and links to their separate handler. Files received before a handler registers are queued.

    Sources: public option, Linux transport, Windows transport, and application contract.

    Verification: all six existing Linux instance tests passed using real sockets/locks, including keyed isolation, Flatpak shared runtime paths, stale sockets and private paths. Three core reopen/open-file/open-link tests passed. On Windows 11, an isolated kernel-only fixture compiled from the unmodified Windows instance implementation and its existing TestInstanceHandsOffByKey passed against actual named mutexes/pipes (default plus two profile owners, files and links); no GUI simulation or desktop-visibility claim is involved.

    No missing implementation was found, so no source change or new PR is needed. The remaining surface, tray and shortcut work has separate issues, including #1374, #1382 and #1383. Closing this already-completed item.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions