Skip to content

Catch second program invocation. #442

@aknrdureegaesr

Description

@aknrdureegaesr

Is your feature request related to a problem? Please describe.

I accidentally started not1mm twice (from different shells in the same tmux). Didn't intend to.

I'm afraid that running two instances of not1mm simultaneously opens a can of worms (or two cans of worms?) and puts them on the table. Don't want that.

Describe the solution you'd like

The second invocation of not1mm should catch the fact that another instance is already running, and, if so, do something sensible.

Several choices:

  • Print an error message to STDERR and refuse to start.
  • Instead of the normal main window, open a yes/no modal asking: "You are about to start a second instance. Is that what you really want to do while the other instance is running?"
  • Or, for a luxury edition version, open a modal window that allows to either not really start this (not yet fully alive) new instance, or else to terminate the previous running instance.

Describe alternatives you've considered

  • Maybe you think there will be no additional bugs, that is, the program is intended to run multiple instances, so my being afraid of "cans of worms" is baseless?
  • Maybe you actually can see a use case of two instances of not1mm for the same user on the same machine?

Random stuff possibly pertinent

Assuming the Python side of Qt provides it, https://doc.qt.io/qt-6/qlockfile.html#details might be helpful.

And once that returns the pid of the other instance and the process name looks right, of course, https://docs.python.org/3/library/os.html#os.kill . I'd use https://docs.python.org/3/library/signal.html#signal.SIGHUP .

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions