Results 1 to 5 of 5

Thread: [FREQ] Multiple instance of same app on Linux & Windows

Threaded View

Previous Post Previous Post   Next Post Next Post
    You found a bug! We've classified it as ION-1037 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha Premium Member
    Join Date
    Mar 2012
    Vote Rating

    Default Answered: [FREQ] Multiple instance of same app on Linux & Windows

    I just found there is an issue with the packaged version for Windows (7) and Linux (Ubuntu).

    If I try to open my app on MacOS, everything is ok, I can see the window and supposing I'm going to minimize it, than to restore by clicking on the app icon (in Application folder), the same window will be restored (same instance/window).

    Doing it with Ubuntu / Windows, the OS will create multiple instances/windows of same app.
    Is it normal behaviour? Am I missing something during the packaging task? How to avoid this?

    Thank you

  2. This is actually expected behavior, not a "bug"...though if you wish it not to happen, this is certainly a valid concern. A little background:

    OS X uses a "new window" paradigm, where an application bundle runs only a single instance of itself, but the user can create new windows for fresh "instances" of the same app, for example...just like creating a new window of Safari or Chrome.

    On Windows & Linux, the same process can have multiple running instances, which is totally a valid occurrence and often times desired. For example, Sencha Architect can have multiple instances running if a user wants to work on multiple projects at the same time. When Desktop Packager multi-window support comes around, the need for multiple instances will be gone.

    Fortunately, you can use the same technique that a lot of applications implement on Windows & Linux to force a single-running instance, as a stop gap until we decide to make this a configuration option. In your main startup JavaScript code, you can run Ion.sys.exec() on Windows & Linux to query for a list of running processes on the system. If there is more than one running instance in that list, you can call to quit the process. Pseudo-code would look something like this:

    var exeName = 'MyApp',
    if (Ion.sys.os === 'windows') {
        processes = Ion.sys.exec('tasklist');
        exeName += '.exe';
    } else if (Ion.sys.os === 'linux') {
        processes = Ion.sys.exec('ps -A');
    if (numMatches(processes, exeName) > 1) {* optional error code here */);
    I'll create a ticket for this request for adding in this ability on the runtime side as a config option. Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts