admin管理员组文章数量:1415484
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.
本文标签: windowsHow to get the current foreground application in electron(Javascript)Stack Overflow
版权声明:本文标题:windows - How to get the current foreground application in electron(Javascript) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745234549a2648975.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论