How can I detect if, for example, a browser is currently open? I need this in my electron-application. ty :)
I've found nothing like this online. I've only found how I can check which window is open from the windows I have in my own application, but I need to know, what else is opened.
It should be something like this:
if(Application.isOpen('Google Chrome'){}
How can I detect if, for example, a browser is currently open? I need this in my electron-application. ty :)
I've found nothing like this online. I've only found how I can check which window is open from the windows I have in my own application, but I need to know, what else is opened.
It should be something like this:
if(Application.isOpen('Google Chrome'){}
Share
Improve this question
edited Oct 11, 2018 at 20:41
Clint
2,79325 silver badges44 bronze badges
asked Oct 11, 2018 at 20:35
MISOMISO
751 silver badge5 bronze badges
2 Answers
Reset to default 6Unless someone has built a specific electron api to do this (which I can't find), then from electron...no. However, the beauty of electron being built with node.js, means that any node module should be able to do the job for you.
For example, ps-list should be able to get you all currently running processes.
psList().then(processes => {
console.log(processes)
})
Which gives a list for me, including:
Just be aware that you need node access from the electron thread attempting to use this lib.
This can easily be abstracted to do a name search in the list for you to get your desired functionality.
You can use find-process in case you need to search by given name, name pattern or pid.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745234549a4617829.html
评论列表(0条)