Yes I know the title may suggest it's duplicate but it's actually not. I searched through internet for the solution but I couldn't find any.
My problem is how to get list (array) of all opened windows globally, not electron windows. Something like Discord gets all apps processes and lists them in Activity in settings.
You can try ps-node and find-process to get all running processes and get their names.
const ps = require('ps-node')
const find = require('find-process')
ps.lookup('', (Err, Programs) => {
Programs.forEach(prog => {
find('pid', prog.pid).then((progDetails) => {
const procName = progDetails.map(stuff => stuff.name)[0]
console.log(procName)
})
});
})
This may not be the cleanest way, but it works!