最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to get the title of the foreground processwindow - Stack Overflow

programmeradmin0浏览0评论

I am developping a crossplatform desktop application using Electron, nodeJs and angular2. My application needs to know, at all time, which foreground process/window is running on the puter. Do you have any idea on how to achieve such a task ?

I am developping a crossplatform desktop application using Electron, nodeJs and angular2. My application needs to know, at all time, which foreground process/window is running on the puter. Do you have any idea on how to achieve such a task ?

Share Improve this question asked Mar 20, 2017 at 20:22 Lolo Lolo 1332 silver badges7 bronze badges 1
  • Maybe the solution is different for each OS. In this case, I prefer to have a solution working on Linux puters first. – Lolo Commented Mar 20, 2017 at 20:26
Add a ment  | 

2 Answers 2

Reset to default 4

To get metadata on active window you can use sindresorhus/active-win: it is multi platform (win, osx, linux) and very easy to implement

First of all you need to detect platform which runs Node app:

os.platform() - https://nodejs/dist/latest-v5.x/docs/api/os.html#os_os_platform

Then you need to run platform specific mand for getting process info with child_process.exec().

https://nodejs/api/child_process.html#child_process_child_process_exec_mand_options_callback

发布评论

评论列表(0)

  1. 暂无评论