user11786942
user11786942

Reputation:

NodeJs shell.openExternal open exe and minimize it

I am using this in electron to open an application and it works fine.

Here is the code:

require('electron').shell.openExternal('"C:\\Program Files (x86)\\myApplication\\myApp.exe"');

My issue is that it opens in front of my main application.

Is there a way of making it minimize?

Upvotes: 3

Views: 833

Answers (1)

Teo M
Teo M

Reputation: 56

You can't minimize the external app, but you can bring the opened app to background by setting activate option to false.

shell.openExternal('pathOrUrl', {activate: false});

The only problem is that it will only work on macOS. On other operating systems, you can focus on your app's window after opening the external link, but it does not always work.

window.focus();
// or
window.webContents.focus();

Electron Docs

Upvotes: 1

Related Questions