Skip to content

Feature Request: Implement a Mutex to Prevent Duplicate Instances of the Application #27

@VistaQvQ

Description

@VistaQvQ

it is possible to launch multiple instances of KeyCastOW accidentally (e.g., by double-clicking the icon multiple times). although KeyCastOW runing in multiple instances can‘t make lead to errors, data corruption, or conflicts as the instances might try to access the same resources (files, network ports, etc.) ,it still looks strange。

I propose implementing a system-wide mutex (mutual exclusion object) during the application's startup sequence. The logic should be as follows:

When the software starts, it should attempt to create or acquire a named mutex unique to the application.

If the mutex is successfully acquired (meaning no other instance is running), the application continues to load normally.

If the mutex cannot be acquired (because another instance already holds it), the new instance should detect this condition. It should then:

Display a user-friendly message (e.g., "The application is already running.").

Terminate itself immediately without initializing the main window.

This ensures that only a single instance of the application can be active at any given time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions