active-win
Get the title / window id / app name / process ID of the active window (macOS, Linux and Windows)
Install
$ npm install --save active-win
Usage
const activeWin = require('active-win');
activeWin().then(result => {
console.log(result);
});
API
activeWin()
Returns a Promise
for the result Object
.
activeWin.sync()
Returns the result Object
.
Result
title
- Window titleid
- Window ID (in macOS and Linux)app
- App owning the windowpid
- Process ID of the app owning the window
Operating system support
It works with macOS, Linux and Windows 7+.
Note: In Windows, there's no notion of a "Window ID". So, when used in Windows, it returns -1
in the id
property of the object.
Related
License
MIT © Sindre Sorhus