NodeJs shell.openExternal open exe and minimize it - node.js

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?

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

Related

Electron: starting terminal in main window

I'm using something like
child_process.exec('start cmd.exe /K bash -c "some commands..."')
to start a terminal. Everything works fine. Of course the terminal opens as a separate window. Is there a way to embed this terminal in the main app window?
There are probably multiple ways to achieve this. One would be using something like xterm. Microsoft Visual Studio Code uses it I believe.
From their description:
Xterm.js is a terminal front-end component written in JavaScript that
works in the browser.
It enables applications to provide fully featured terminals to their
users and create great development experiences.

Electron shell.openExternal can't open some .lnk shortcuts

I'm creating a launcher using electron. It launches applications and files in my Windows system using the shell.openExternal command.
It works well when I call shell.openExternal passing .lnk shortcuts as parameters, but when I call some apparently equal shortcuts created by, for example, GoG installers, the game is not launched and I can't debug what happens. I know that the shortcut is called but the target application crashes. I got this message from Lichdom: Battlemage launcher:
Witcher 3 also fails, nos message is displayed. When I call these shortcuts directly from the system, they work fine. If I manually create an apparently exact same shortcut to the same file, it launches normally in both electron and the explorer.
Any ideas what could be happening or how to debug?

Stop node-debug from opening a new browser window

The command:
node-debug sls offline
opens a new browser window every time it is run.
How do we stop it from opening a new window every time? I want to reuse the existing window!
This is a known issue with node inspector. Take a look here.
Since 0.9.0 we use https://github.com/benderjs/browser-launcher2 to
start the browser, and make sure it's Chrome/Chromium/Opera (i.e. the
browsers that can properly render node inspector; we detect installed
browsers in the system and choose the most appropriate one; earlier we
used opener module which just delegated opening the browser to the OS,
which would open the defaul browser, which could have been e.g.
Firefox) and this could be the reason why the behavior has changed.
browser-launcher2 actually does a bit more than just launching a
browser, for instance it creates a new profile for Chrome in a
subfolder of ~/ - this is probably the issue that #CalvinScott
reported (i.e. Chrome that was opened was the new profile created by
browser-launcher, not your original profile; you should be able to
open your original profile of Chrome normally)
Also, you may consider this:
Since version 6.3, Node.js provides a buit-in DevTools-based debugger
which mostly deprecates Node Inspector, see e.g. this blog post to get
started. The built-in debugger is developed directly by the
V8/Chromium team and provides certain advanced features (e.g.
long/async stack traces) that are too difficult to implement in Node
Inspector.

Electron: How to handle open commands with multiple Windows users?

My Electron app shows files inside their enclosing folder using the standard command shell.showItemInFolder(fullPath). Works.
Now when two Windows users are signed in and they both use the app, the file is always shown on the Windows desktop of the user opened the app first.
In real life, it looks as if the function is broken, but actually the Windows Explorer is simply opened in the other Windows user's session in the background.
Does anyone know how to get rid of this problem?

NodeWebkit + CKEditor Crashing app in OSX

I am using Nodewebkit for creating a simple Desktop application and I have integrated CKEditor in it.
Currently facing some issues with CKEditor in app in "MAC only" which crashes app(Closes app currently).
Steps to reproduce bug:
Open CKEditor in app
Type few words and make it bold
After press of two enter keys, it closes app (Crashes).
This is happening when user clicks on Bold/Italic/Underline Icon only and also happends only when .app file is created.
While testing locally by running GULP, it works without crashing application.
Is there any way I can fix this issue?
Thanks in Advance
Update: App will crash only if HTML Encoding is used. But if HTML Encoding is not done, then it shows special symbols for enter key pressed.

Resources