Home
Head's Up: I'm in the middle of upgrading my site. Most things are in place, but there are something missing and/or broken including image alt text. Please bear with me while I'm getting things fixed.

List The Foreground Apps Running On A Mac With JavaScript

osascript
#!/usr/bin/env osascript -l JavaScript

const sysEvents = Application("System Events")
const allProcesses = sysEvents.processes
const foregroundProcesses = allProcesses.whose({"backgroundOnly": {'=': false }})

for (let pIndex = 0; pIndex < foregroundProcesses.length; pIndex ++ ) {
  console.log(
    ``${pIndex} - `` +
    ``${foregroundProcesses[pIndex].name()} - `` +
    `${foregroundProcesses[pIndex].displayedName()}`
  )
}
results start

- Some display names are different from the internally used names. For example, "Electron" and "Code"