sindresorhus/opn

Do you want to work on this issue?

You can request for a bounty in order to promote it!

How to activate an app without opening a target? #153

wearhere posted onGitHub

On OS X, at least (not sure about other platforms), it is possible to use open to bring an existing window of an app to the foreground. Example:

open -a Terminal

Is it possible to do this with this project? It seems like target is required so I won't be able to mimic open -a Terminal exactly. I tried passing an empty target

open('', {
  app: 'Terminal'
}).catch((err) => {
  debug('Could not activate Terminal:', err);
});

but this opens a new Terminal window rather than bringing the existing one to the foreground.


We could potentially make the target argument optional, but first I think you should confirm that not specifying target would bring existing window of an app to the foreground on Windows and Linux too. Because if it only works on macOS, there's not much point adding it here.

posted by sindresorhus over 5 years ago

I think you should confirm that not specifying target would bring existing window of an app to the foreground on Windows and Linux too

Agreed, I think that this is a great bar for adding the capability to this project. Unfortunately I don't have access to Windows nor Linux setups. Hopefully someone else might be able and willing to test.

posted by wearhere over 5 years ago

Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests